From ee92c6100fd18a80309bcaa86d1cbc20f8f2cd49 Mon Sep 17 00:00:00 2001 From: yuzu-eva Date: Fri, 23 Dec 2022 21:20:52 +0100 Subject: added a bunch of stuff and relocated some files --- .config/shell/aliasrc | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 .config/shell/aliasrc (limited to '.config/shell/aliasrc') diff --git a/.config/shell/aliasrc b/.config/shell/aliasrc new file mode 100644 index 0000000..63b4434 --- /dev/null +++ b/.config/shell/aliasrc @@ -0,0 +1,99 @@ +## MISCELLANEOUS + +# various shortcuts +alias reboot='sudo openrc-shutdown -r' +alias poweroff='sudo openrc-shutdown -p' +alias pms='sudo pm-suspend' +alias refresh='source $ZDOTDIR/.zshrc' +alias fuck='sudo $(fc -Lln -1)' +alias open='xdg-open' +alias mutt='pushd ~/.mutt/attachments; mutt; popd' +alias jpwine='LANG=ja_JP.UTF-8 WINEDEBUG=-all wine' +alias emacsd='/usr/local/bin/emacs --daemon' +alias e="$EDITOR" +alias z='zathura' +alias cn='clear;macchina' +alias nnn='nnn -Hde' +alias freyr='sudo docker run -it --rm -v /hdd/music:/data freyrcli/freyrjs' + +# cp mv and rm always verbose +alias cp='cp -iv' +alias mv='mv -iv' +alias rm='rm -Iv' +alias mkd='mkdir -pv' + +# Colorize grep output +alias grep='grep --color=auto -i' + +# color ls, always full info and human readable; group dirs +alias ls='ls -hl --color=always --group-directories-first' +alias la='ls -a' + +# Control Audio +alias headset="wpctl set-default $(wpctl status | grep 'Headphones' | cut -b11-12)" +alias speakers="wpctl set-default $(wpctl status | grep 'Speakers' | cut -b11-12)" +alias setvol='pactl set-sink-volume @DEFAULT_SINK@' + +# Monitor / Resolution settings, mainly for playing old-ass games +alias setrmon-lowres='xrandr --auto --output HDMI-A-0 --mode 640x480 --primary' +alias setrmon-midres='xrandr --auto --output HDMI-A-0 --mode 800x600 --primary' +alias setrmon-default='xrandr --auto --output HDMI-A-0 --mode 1920x1080 --primary' +alias setlmon-lowres='xrandr --auto --output DisplayPort-2 --mode 640x480 --left-of HDMI-A-0' +alias setlmon-midres='xrandr --auto --output DisplayPort-2 --mode 800x600 --left-of HDMI-A-0' +alias setlmon-default='xrandr --auto --output DisplayPort-2 --mode 1600x900 --left-of HDMI-A-0' + +## FUNCTIONS FOR CONVERTING DATE TO ISO 8601 + +# convert date from YYYYMMDD to YYYY-MM-DD +date-convert() { + for i in *; do + mv "${i}" "$(echo "${i}" | + sed 's/\([0-9][0-9][0-9][0-9]\)\([0-9][0-9]\)\([0-9][0-9]\)/\1-\2-\3/')" + done; +} + +# reverse date from DD-MM-YYYY to YYYY-MM-DD +date-reverse() { + for i in *; do + mv "${i}" "$(echo "${i}" | + sed 's/\([0-9][0-9]\)-\([0-9][0-9]\)-\([0-9][0-9][0-9][0-9]\)/\3-\1-\2/')" + done; +} + +## DOWNLOADING AND CONVERTING VIDEO + +# shortcuts for most used yt-dlp settings +alias ytvid='yt-dlp -o "/hdd/vids/random/%(title)s.%(ext)s" --remux-video "mkv"' +alias ytarchive='yt-dlp -o "/hdd/vids/archives/%(uploader)s/%(upload_date)s - %(title)s/%(title)s.%(ext)s" --remux-video "mkv"' + +# convert video files to webm +mkwebm() { + ffmpeg -i "${1}" -crf 1 -b:v 1M -c:a libvorbis "${1%.*}".webm +} + +## GIT + +# general shortcuts +alias commit='git commit -m' +alias fetch='git fetch' +alias upstream='git push --set-upstream origin' +alias remote='git remote add origin' +alias pull='git pull origin' +alias push='git push origin' + +# shortcut for dotfiles repo +alias dfiles='/usr/bin/git --git-dir=$HOME/.dotfiles --work-tree=$HOME' +alias dcomm='dfiles commit -m' +alias dpush='dfiles push origin' + +## PACKAGE MANAGER + +alias aptin='sudo apt install' +alias aptup='sudo apt update && sudo apt upgrade' +alias aptupd='sudo apt update' +alias aptupg='sudo apt upgrade' +alias aptrm='sudo apt remove' +alias aptsr='sudo apt search' +alias aptsh='sudo apt show' +alias listup='sudo apt list --upgradeable' +alias listin='sudo apt list --installed' -- cgit v1.2.3 From 275b74ab4f23e2ddf40c4d4bb411a00d116aee8c Mon Sep 17 00:00:00 2001 From: yuzu-eva Date: Fri, 23 Dec 2022 23:48:27 +0100 Subject: added mpv scripts --- .config/mpv/input.conf | 23 ++ .config/mpv/script-opts/crop.conf | 34 +++ .config/mpv/script-opts/encode_webm.conf | 39 +++ .config/mpv/scripts/crop.lua | 434 ++++++++++++++++++++++++++++++ .config/mpv/scripts/encode.lua | 315 ++++++++++++++++++++++ .config/nvim/lua/user/plugins/dracula.lua | 4 +- .config/shell/aliasrc | 1 + .config/shell/profile | 4 +- 8 files changed, 850 insertions(+), 4 deletions(-) create mode 100644 .config/mpv/input.conf create mode 100644 .config/mpv/script-opts/crop.conf create mode 100644 .config/mpv/script-opts/encode_webm.conf create mode 100644 .config/mpv/scripts/crop.lua create mode 100644 .config/mpv/scripts/encode.lua (limited to '.config/shell/aliasrc') diff --git a/.config/mpv/input.conf b/.config/mpv/input.conf new file mode 100644 index 0000000..396711e --- /dev/null +++ b/.config/mpv/input.conf @@ -0,0 +1,23 @@ +# crop.lua +# ========== +# start cropping +c script-message-to crop start-crop hard +alt+c script-message-to crop start-crop soft +# delogo mode can be used like so +l script-message-to crop start-crop delogo +# remove the crop +d vf del -1 + +# or use the ready-made "toggle" binding +C script-message-to crop toggle-crop hard + +# remove the soft zoom +0 set video-pan-x 0; set video-pan-y 0; set video-zoom 0 + +# encode.lua +# ============ +# use default profile (makes vp8 webms) +E script-message-to encode set-timestamp + +# use webm profile +e script-message-to encode set-timestamp encode_webm diff --git a/.config/mpv/script-opts/crop.conf b/.config/mpv/script-opts/crop.conf new file mode 100644 index 0000000..9f75cdf --- /dev/null +++ b/.config/mpv/script-opts/crop.conf @@ -0,0 +1,34 @@ +# default mode to be used if not specified in the script-message +# can be hard, soft or delogo +# in hard mode, a crop filter is applied to the video +# in soft mode, video-zoom, video-pan-x and video-pan-y are modified to simulate the cropping +# in delogo mode, the delogo filter is applied to the selected are +# hard mode interacts nicely with encode.lua, soft mode does not +mode=hard + +draw_crosshair=yes +draw_text=yes +draw_shade=yes +draw_frame=yes +frame_border_width=2 +frame_border_color=EEEEEE +# hexadecimal: 00 is opaque, FF is transparent +shade_opacity=77 +mouse_support=yes + +# movement is defined in pixels in the window +# which explains the mismatch with the text (in video space) +coarse_movement=30 +left_coarse=LEFT +right_coarse=RIGHT +up_coarse=UP +down_coarse=DOWN +fine_movement=1 +left_fine=ALT+LEFT +right_fine=ALT+RIGHT +up_fine=ALT+UP +down_fine=ALT+DOWN + +# these two options accept comma separated list of keys +accept=ENTER,MOUSE_BTN0 +cancel=ESC diff --git a/.config/mpv/script-opts/encode_webm.conf b/.config/mpv/script-opts/encode_webm.conf new file mode 100644 index 0000000..06cdc34 --- /dev/null +++ b/.config/mpv/script-opts/encode_webm.conf @@ -0,0 +1,39 @@ +# if yes, only encode the currently active tracks +# for example, mute the player / hide the subtitles if you don't want audio / subs to be part of the extract +only_active_tracks=no + +# whether to preserve some of the applied filters (crop, rotate, flip and mirror) into the extract +# this is pretty useful in combination with crop.lua +# note that you cannot copy video streams and apply filters at the same time +preserve_filters=yes + +# apply another filter after the ones from the previous option if any +# can be used to limit the resolution of the output, for example with +# append_filter=scale=2*trunc(iw/max(1\,sqrt((iw*ih)/(960*540)))/2):-2 +append_filter= + +# additional parameters passed to ffmpeg +codec=-c:a libvorbis -crf 1 -b:v 1M + +# format of the output filename +# Does basic interpolation on the following variables: $f, $x, $t, $s, $e, $d, $p, $n which respectively represent +# input filename, input extension, title, start timestamp, end timestamp, duration, profile name and an incrementing number in case of conflicts +# if the extension is not among the recognized ones, it will default to mkv +output_format=$f_$n.webm + +# the directory in which to create the extract +# empty means the same directory as the input file +# relative paths are relative to mpv's working directory, absolute ones work like you would expect +output_directory=~/vids/ + +# if yes, the ffmpeg process will run detached from mpv and we won't know if it succeeded or not +# if no, we know the result of calling ffmpeg, but we can only encode one extract at a time and mpv will block on exit +detached=yes + +# executable to run when encoding (or its full path if not in PATH) +# for example, this can be used with a wrapper script that calls ffmpeg and triggers a notification when finished +# note that the executable gets the ffmpeg arguments as-is, and is expected to call ffmpeg itself +ffmpeg_command=ffmpeg + +# if yes, print the ffmpeg call before executing it +print=yes diff --git a/.config/mpv/scripts/crop.lua b/.config/mpv/scripts/crop.lua new file mode 100644 index 0000000..adbfaa3 --- /dev/null +++ b/.config/mpv/scripts/crop.lua @@ -0,0 +1,434 @@ +local opts = { + mode = "hard", -- can be "hard" or "soft". If hard, apply a crop filter, if soft zoom + pan. Or a bonus "delogo" mode + draw_shade = true, + shade_opacity = "77", + draw_frame = false, + frame_border_width = 2, + frame_border_color = "EEEEEE", + draw_crosshair = true, + draw_text = true, + mouse_support = true, + coarse_movement = 30, + left_coarse = "LEFT", + right_coarse = "RIGHT", + up_coarse = "UP", + down_coarse = "DOWN", + fine_movement = 1, + left_fine = "ALT+LEFT", + right_fine = "ALT+RIGHT", + up_fine = "ALT+UP", + down_fine = "ALT+DOWN", + accept = "ENTER,MOUSE_BTN0", + cancel = "ESC", +} +(require 'mp.options').read_options(opts) + +function split(input) + local ret = {} + for str in string.gmatch(input, "([^,]+)") do + ret[#ret + 1] = str + end + return ret +end +local msg = require 'mp.msg' + +opts.accept = split(opts.accept) +opts.cancel = split(opts.cancel) +function mode_ok(mode) + return mode == "soft" or mode == "hard" or mode == "delogo" +end +if not mode_ok(opts.mode) then + msg.error("Invalid mode value: " .. opts.mode) + return +end + +local assdraw = require 'mp.assdraw' +local active = false +local active_mode = "" -- same possible values as opts.mode +local rect_centered = false +local rect_keepaspect = false +local needs_drawing = false +local crop_first_corner = nil -- in normalized video space +local crop_cursor = { + x = 0, + y = 0 +} + +function redraw() + needs_drawing = true +end + +function rect_from_two_points(p1, p2, centered, ratio) + local c1 = {p1.x, p1.y} + local c2 = {p2.x, p2.y} + if ratio then + -- adjust position of p2, such + if math.abs(c2[1] - c1[1]) < ratio * math.abs(c2[2] - c1[2]) then + local is_left = c2[1] < c1[1] and -1 or 1 + c2[1] = c1[1] + is_left * math.abs(c2[2] - c1[2]) * ratio + else + local is_up = c2[2] < c1[2] and -1 or 1 + c2[2] = c1[2] + is_up * math.abs(c2[1] - c1[1]) / ratio + end + end + if centered then + -- p1 is center => convert it into corner + c1[1] = c1[1] - (c2[1] - c1[1]) + c1[2] = c1[2] - (c2[2] - c1[2]) + end + -- sort corners + if c1[1] > c2[1] then c1[1], c2[1] = c2[1], c1[1] end + if c1[2] > c2[2] then c1[2], c2[2] = c2[2], c1[2] end + return { x = c1[1], y = c1[2] }, { x = c2[1], y = c2[2] } +end + +function clamp(low, value, high) + if value <= low then + return low + elseif value >= high then + return high + else + return value + end +end + +function clamp_point(top_left, point, bottom_right) + return { + x = clamp(top_left.x, point.x, bottom_right.x), + y = clamp(top_left.y, point.y, bottom_right.y) + } +end + +function screen_to_video_norm(point, dim) + return { + x = (point.x - dim.ml) / (dim.w - dim.ml - dim.mr), + y = (point.y - dim.mt) / (dim.h - dim.mt - dim.mb) + } +end + +function video_norm_to_screen(point, dim) + return { + x = math.floor(point.x * (dim.w - dim.ml - dim.mr) + dim.ml + 0.5), + y = math.floor(point.y * (dim.h - dim.mt - dim.mb) + dim.mt + 0.5) + } +end + +function draw_shade(ass, unshaded, window) + ass:new_event() + ass:pos(0, 0) + ass:append("{\\an7}") + ass:append("{\\bord0}") + ass:append("{\\shad0}") + ass:append("{\\c&H000000&}") + ass:append("{\\1a&H" .. opts.shade_opacity .. "}") + ass:append("{\\2a&HFF}") + ass:append("{\\3a&HFF}") + ass:append("{\\4a&HFF}") + local c1, c2 = unshaded.top_left, unshaded.bottom_right + local v = window + -- c1.x c2.x + -- +-----+------------+ + -- | | ur | + -- c1.y| ul +-------+----+ + -- | | | | + -- c2.y+-----+-------+ lr | + -- | ll | | + -- +-------------+----+ + ass:draw_start() + ass:rect_cw(v.top_left.x, v.top_left.y, c1.x, c2.y) -- ul + ass:rect_cw(c1.x, v.top_left.y, v.bottom_right.x, c1.y) -- ur + ass:rect_cw(v.top_left.x, c2.y, c2.x, v.bottom_right.y) -- ll + ass:rect_cw(c2.x, c1.y, v.bottom_right.x, v.bottom_right.y) -- lr + ass:draw_stop() + -- also possible to draw a rect over the whole video + -- and \iclip it in the middle, but seemingy slower +end + +function draw_frame(ass, frame) + ass:new_event() + ass:pos(0, 0) + ass:append("{\\an7}") + ass:append("{\\bord0}") + ass:append("{\\shad0}") + ass:append("{\\c&H" .. opts.frame_border_color .. "&}") + ass:append("{\\1a&H00&}") + ass:append("{\\2a&HFF&}") + ass:append("{\\3a&HFF&}") + ass:append("{\\4a&HFF&}") + local c1, c2 = frame.top_left, frame.bottom_right + local b = opts.frame_border_width + ass:draw_start() + ass:rect_cw(c1.x, c1.y - b, c2.x + b, c1.y) + ass:rect_cw(c2.x, c1.y, c2.x + b, c2.y + b) + ass:rect_cw(c1.x - b, c2.y, c2.x, c2.y + b) + ass:rect_cw(c1.x - b, c1.y - b, c1.x, c2.y) + ass:draw_stop() +end + +function draw_crosshair(ass, center, window_size) + ass:new_event() + ass:pos(0, 0) + ass:append("{\\an7}") + ass:append("{\\bord0}") + ass:append("{\\shad0}") + ass:append("{\\c&HBBBBBB&}") + ass:append("{\\1a&H00&}") + ass:append("{\\2a&HFF&}") + ass:append("{\\3a&HFF&}") + ass:append("{\\4a&HFF&}") + ass:draw_start() + ass:rect_cw(center.x - 0.5, 0, center.x + 0.5, window_size.h) + ass:rect_cw(0, center.y - 0.5, window_size.w, center.y + 0.5) + ass:draw_stop() +end + +function draw_position_text(ass, text, position, window_size, offset) + ass:new_event() + local align = 1 + local ofx = 1 + local ofy = -1 + if position.x > window_size.w / 2 then + align = align + 2 + ofx = -1 + end + if position.y < window_size.h / 2 then + align = align + 6 + ofy = 1 + end + ass:append("{\\an"..align.."}") + ass:append("{\\fs26}") + ass:append("{\\bord1.5}") + ass:pos(ofx*offset + position.x, ofy*offset + position.y) + ass:append(text) +end + +function draw_crop_zone() + if needs_drawing then + local dim = mp.get_property_native("osd-dimensions") + if not dim then + cancel_crop() + return + end + + local cursor = { + x = crop_cursor.x, + y = crop_cursor.y, + } + local ass = assdraw.ass_new() + + if crop_first_corner and (opts.draw_shade or opts.draw_frame) then + local frame = {} + frame.top_left, frame.bottom_right = rect_from_two_points( + video_norm_to_screen(crop_first_corner, dim), + cursor, + rect_centered, + rect_keepaspect and dim.w/dim.h) + -- don't draw shade over non-visible video parts + if opts.draw_shade then + local window = { + top_left = { x = 0, y = 0 }, + bottom_right = { x = dim.w, y = dim.h }, + } + draw_shade(ass, frame, window) + end + if opts.draw_frame then + draw_frame(ass, frame) + end + end + + + if opts.draw_crosshair then + draw_crosshair(ass, cursor, { w = dim.w, h = dim.h }) + end + + if opts.draw_text then + local vop = mp.get_property_native("video-out-params") + if vop then + local cursor_norm = screen_to_video_norm(cursor, dim) + local text = string.format("%d, %d", cursor_norm.x * vop.w, cursor_norm.y * vop.h) + if crop_first_corner then + text = string.format("%s (%dx%d)", text, + math.abs((cursor_norm.x - crop_first_corner.x) * vop.w ), + math.abs((cursor_norm.y - crop_first_corner.y) * vop.h ) + ) + end + draw_position_text(ass, text, cursor, { w = dim.w, h = dim.h }, 6) + end + end + + mp.set_osd_ass(dim.w, dim.h, ass.text) + needs_drawing = false + end +end + +function crop_video(x1, y1, x2, y2) + if active_mode == "soft" then + local w = x2 - x1 + local h = y2 - y1 + local dim = mp.get_property_native("osd-dimensions") + if not dim then return end + + local zoom = mp.get_property_number("video-zoom") + local newZoom1 = math.log(dim.h * (2 ^ zoom) / (dim.h - dim.mt - dim.mb) / h) / math.log(2) + local newZoom2 = math.log(dim.w * (2 ^ zoom) / (dim.w - dim.ml - dim.mr) / w) / math.log(2) + mp.set_property("video-zoom", math.min(newZoom1, newZoom2)) + mp.set_property("video-pan-x", 0.5 - (x1 + w / 2)) + mp.set_property("video-pan-y", 0.5 - (y1 + h / 2)) + elseif active_mode == "hard" or active_mode == "delogo" then + x1 = clamp(0, x1, 1) + y1 = clamp(0, y1, 1) + x2 = clamp(0, x2, 1) + y2 = clamp(0, y2, 1) + local vop = mp.get_property_native("video-out-params") + local vf_table = mp.get_property_native("vf") + local x = math.floor(x1 * vop.w + 0.5) + local y = math.floor(y1 * vop.h + 0.5) + local w = math.floor((x2 - x1) * vop.w + 0.5) + local h = math.floor((y2 - y1) * vop.h + 0.5) + if active_mode == "delogo" then + -- delogo is a little special and needs some padding to function + w = math.min(vop.w - 1, w) + h = math.min(vop.h - 1, h) + x = math.max(1, x) + y = math.max(1, y) + if x + w == vop.w then w = w - 1 end + if y + h == vop.h then h = h - 1 end + end + vf_table[#vf_table + 1] = { + name=(active_mode == "hard") and "crop" or "delogo", + params= { x = tostring(x), y = tostring(y), w = tostring(w), h = tostring(h) } + } + mp.set_property_native("vf", vf_table) + end +end + +function update_crop_zone_state() + local dim = mp.get_property_native("osd-dimensions") + if not dim then + cancel_crop() + return + end + local corner = crop_cursor + if crop_first_corner == nil then + crop_first_corner = screen_to_video_norm(crop_cursor, dim) + redraw() + else + local c1, c2 = rect_from_two_points( + video_norm_to_screen(crop_first_corner, dim), + crop_cursor, + rect_centered, + rect_keepaspect and dim.w/dim.h) + local c1norm = screen_to_video_norm(c1, dim) + local c2norm = screen_to_video_norm(c2, dim) + crop_video(c1norm.x, c1norm.y, c2norm.x, c2norm.y) + cancel_crop() + end +end + +local bindings = {} +local bindings_repeat = {} + +function cancel_crop() + crop_first_corner = nil + for key, _ in pairs(bindings) do + mp.remove_key_binding("crop-"..key) + end + for key, _ in pairs(bindings_repeat) do + mp.remove_key_binding("crop-"..key) + end + mp.unobserve_property(redraw) + mp.unregister_idle(draw_crop_zone) + mp.set_osd_ass(1280, 720, '') + active = false +end + +function start_crop(mode) + if active then return end + if not mp.get_property_native("osd-dimensions") then return end + if mode and not mode_ok(mode) then + msg.error("Invalid mode value: " .. mode) + return + end + local mode_maybe = mode or opts.mode + if mode_maybe ~= 'soft' then + local hwdec = mp.get_property("hwdec-current") + if hwdec and hwdec ~= "no" and not string.find(hwdec, "-copy$") then + msg.error("Cannot crop with hardware decoding active (see manual)") + return + end + end + active = true + active_mode = mode_maybe + + if opts.mouse_support then + crop_cursor.x, crop_cursor.y = mp.get_mouse_pos() + end + redraw() + for key, func in pairs(bindings) do + mp.add_forced_key_binding(key, "crop-"..key, func) + end + for key, func in pairs(bindings_repeat) do + mp.add_forced_key_binding(key, "crop-"..key, func, { repeatable = true }) + end + mp.register_idle(draw_crop_zone) + mp.observe_property("osd-dimensions", nil, redraw) +end + +function toggle_crop(mode) + if mode and not mode_ok(mode) then + msg.error("Invalid mode value: " .. mode) + end + local toggle_mode = mode or opts.mode + if toggle_mode == "soft" then return end -- can't toggle soft mode + + local remove_filter = function() + local to_remove = (toggle_mode == "hard") and "crop" or "delogo" + local vf_table = mp.get_property_native("vf") + if #vf_table > 0 then + for i = #vf_table, 1, -1 do + if vf_table[i].name == to_remove then + for j = i, #vf_table-1 do + vf_table[j] = vf_table[j+1] + end + vf_table[#vf_table] = nil + mp.set_property_native("vf", vf_table) + return true + end + end + end + return false + end + if not remove_filter() then + start_crop(mode) + end +end + +-- bindings +if opts.mouse_support then + bindings["MOUSE_MOVE"] = function() crop_cursor.x, crop_cursor.y = mp.get_mouse_pos(); redraw() end +end +for _, key in ipairs(opts.accept) do + bindings[key] = update_crop_zone_state +end +for _, key in ipairs(opts.cancel) do + bindings[key] = cancel_crop +end +function movement_func(move_x, move_y) + return function() + crop_cursor.x = crop_cursor.x + move_x + crop_cursor.y = crop_cursor.y + move_y + redraw() + end +end +bindings_repeat[opts.left_coarse] = movement_func(-opts.coarse_movement, 0) +bindings_repeat[opts.right_coarse] = movement_func(opts.coarse_movement, 0) +bindings_repeat[opts.up_coarse] = movement_func(0, -opts.coarse_movement) +bindings_repeat[opts.down_coarse] = movement_func(0, opts.coarse_movement) +bindings_repeat[opts.left_fine] = movement_func(-opts.fine_movement, 0) +bindings_repeat[opts.right_fine] = movement_func(opts.fine_movement, 0) +bindings_repeat[opts.up_fine] = movement_func(0, -opts.fine_movement) +bindings_repeat[opts.down_fine] = movement_func(0, opts.fine_movement) + + +mp.add_key_binding(nil, "start-crop", start_crop) +mp.add_key_binding(nil, "toggle-crop", toggle_crop) diff --git a/.config/mpv/scripts/encode.lua b/.config/mpv/scripts/encode.lua new file mode 100644 index 0000000..df518d8 --- /dev/null +++ b/.config/mpv/scripts/encode.lua @@ -0,0 +1,315 @@ +local utils = require "mp.utils" +local msg = require "mp.msg" +local options = require "mp.options" + +local ON_WINDOWS = (package.config:sub(1,1) ~= "/") + +local start_timestamp = nil +local profile_start = "" + +-- implementation detail of the osd message +local timer = nil +local timer_duration = 2 + +function append_table(lhs, rhs) + for i = 1,#rhs do + lhs[#lhs+1] = rhs[i] + end + return lhs +end + +function file_exists(name) + local f = io.open(name, "r") + if f ~= nil then + io.close(f) + return true + else + return false + end +end + +function get_extension(path) + local candidate = string.match(path, "%.([^.]+)$") + if candidate then + for _, ext in ipairs({ "mkv", "webm", "mp4", "avi" }) do + if candidate == ext then + return candidate + end + end + end + return "mkv" +end + +function get_output_string(dir, format, input, extension, title, from, to, profile) + local res = utils.readdir(dir) + if not res then + return nil + end + local files = {} + for _, f in ipairs(res) do + files[f] = true + end + local output = format + output = string.gsub(output, "$f", function() return input end) + output = string.gsub(output, "$t", function() return title end) + output = string.gsub(output, "$s", function() return seconds_to_time_string(from, true) end) + output = string.gsub(output, "$e", function() return seconds_to_time_string(to, true) end) + output = string.gsub(output, "$d", function() return seconds_to_time_string(to-from, true) end) + output = string.gsub(output, "$x", function() return extension end) + output = string.gsub(output, "$p", function() return profile end) + if ON_WINDOWS then + output = string.gsub(output, "[/\\|<>?:\"*]", "_") + end + if not string.find(output, "$n") then + return files[output] and nil or output + end + local i = 1 + while true do + local potential_name = string.gsub(output, "$n", tostring(i)) + if not files[potential_name] then + return potential_name + end + i = i + 1 + end +end + +function get_video_filters() + local filters = {} + for _, vf in ipairs(mp.get_property_native("vf")) do + local name = vf["name"] + name = string.gsub(name, '^lavfi%-', '') + local filter + if name == "crop" then + local p = vf["params"] + filter = string.format("crop=%d:%d:%d:%d", p.w, p.h, p.x, p.y) + elseif name == "mirror" then + filter = "hflip" + elseif name == "flip" then + filter = "vflip" + elseif name == "rotate" then + local rotation = vf["params"]["angle"] + -- rotate is NOT the filter we want here + if rotation == "90" then + filter = "transpose=clock" + elseif rotation == "180" then + filter = "transpose=clock,transpose=clock" + elseif rotation == "270" then + filter = "transpose=cclock" + end + end + filters[#filters + 1] = filter + end + return filters +end + +function get_input_info(default_path, only_active) + local accepted = { + video = true, + audio = not mp.get_property_bool("mute"), + sub = mp.get_property_bool("sub-visibility") + } + local ret = {} + for _, track in ipairs(mp.get_property_native("track-list")) do + local track_path = track["external-filename"] or default_path + if not only_active or (track["selected"] and accepted[track["type"]]) then + local tracks = ret[track_path] + if not tracks then + ret[track_path] = { track["ff-index"] } + else + tracks[#tracks + 1] = track["ff-index"] + end + end + end + return ret +end + +function seconds_to_time_string(seconds, full) + local ret = string.format("%02d:%02d.%03d" + , math.floor(seconds / 60) % 60 + , math.floor(seconds) % 60 + , seconds * 1000 % 1000 + ) + if full or seconds > 3600 then + ret = string.format("%d:%s", math.floor(seconds / 3600), ret) + end + return ret +end + +function start_encoding(from, to, settings) + local args = { + settings.ffmpeg_command, + "-loglevel", "panic", "-hide_banner", + } + local append_args = function(table) args = append_table(args, table) end + + local path = mp.get_property("path") + local is_stream = not file_exists(path) + if is_stream then + path = mp.get_property("stream-path") + end + + local track_args = {} + local start = seconds_to_time_string(from, false) + local input_index = 0 + for input_path, tracks in pairs(get_input_info(path, settings.only_active_tracks)) do + append_args({ + "-ss", start, + "-i", input_path, + }) + if settings.only_active_tracks then + for _, track_index in ipairs(tracks) do + track_args = append_table(track_args, { "-map", string.format("%d:%d", input_index, track_index)}) + end + else + track_args = append_table(track_args, { "-map", tostring(input_index)}) + end + input_index = input_index + 1 + end + + append_args({"-to", tostring(to-from)}) + append_args(track_args) + + -- apply some of the video filters currently in the chain + local filters = {} + if settings.preserve_filters then + filters = get_video_filters() + end + if settings.append_filter ~= "" then + filters[#filters + 1] = settings.append_filter + end + if #filters > 0 then + append_args({ "-filter:v", table.concat(filters, ",") }) + end + + -- split the user-passed settings on whitespace + for token in string.gmatch(settings.codec, "[^%s]+") do + args[#args + 1] = token + end + + -- path of the output + local output_directory = settings.output_directory + if output_directory == "" then + if is_stream then + output_directory = "." + else + output_directory, _ = utils.split_path(path) + end + else + output_directory = string.gsub(output_directory, "^~", os.getenv("HOME") or "~") + end + local input_name = mp.get_property("filename/no-ext") or "encode" + local title = mp.get_property("media-title") + local extension = get_extension(path) + local output_name = get_output_string(output_directory, settings.output_format, input_name, extension, title, from, to, settings.profile) + if not output_name then + mp.osd_message("Invalid path " .. output_directory) + return + end + args[#args + 1] = utils.join_path(output_directory, output_name) + + if settings.print then + local o = "" + -- fuck this is ugly + for i = 1, #args do + local fmt = "" + if i == 1 then + fmt = "%s%s" + elseif i >= 2 and i <= 4 then + fmt = "%s" + elseif args[i-1] == "-i" or i == #args or args[i-1] == "-filter:v" then + fmt = "%s '%s'" + else + fmt = "%s %s" + end + o = string.format(fmt, o, args[i]) + end + print(o) + end + if settings.detached then + utils.subprocess_detached({ args = args }) + else + local res = utils.subprocess({ args = args, max_size = 0, cancellable = false }) + if res.status == 0 then + mp.osd_message("Finished encoding succesfully") + else + mp.osd_message("Failed to encode, check the log") + end + end +end + +function clear_timestamp() + timer:kill() + start_timestamp = nil + profile_start = "" + mp.remove_key_binding("encode-ESC") + mp.remove_key_binding("encode-ENTER") + mp.osd_message("", 0) +end + +function set_timestamp(profile) + if not mp.get_property("path") then + mp.osd_message("No file currently playing") + return + end + if not mp.get_property_bool("seekable") then + mp.osd_message("Cannot encode non-seekable media") + return + end + + if not start_timestamp or profile ~= profile_start then + profile_start = profile + start_timestamp = mp.get_property_number("time-pos") + local msg = function() + mp.osd_message( + string.format("encode [%s]: waiting for end timestamp", profile or "default"), + timer_duration + ) + end + msg() + timer = mp.add_periodic_timer(timer_duration, msg) + mp.add_forced_key_binding("ESC", "encode-ESC", clear_timestamp) + mp.add_forced_key_binding("ENTER", "encode-ENTER", function() set_timestamp(profile) end) + else + local from = start_timestamp + local to = mp.get_property_number("time-pos") + if to <= from then + mp.osd_message("Second timestamp cannot be before the first", timer_duration) + timer:kill() + timer:resume() + return + end + clear_timestamp() + mp.osd_message(string.format("Encoding from %s to %s" + , seconds_to_time_string(from, false) + , seconds_to_time_string(to, false) + ), timer_duration) + -- include the current frame into the extract + local fps = mp.get_property_number("container-fps") or 30 + to = to + 1 / fps / 2 + local settings = { + detached = true, + container = "", + only_active_tracks = false, + preserve_filters = true, + append_filter = "", + codec = "-an -sn -c:v libvpx -crf 10 -b:v 1000k", + output_format = "$f_$n.webm", + output_directory = "", + ffmpeg_command = "ffmpeg", + print = true, + } + if profile then + options.read_options(settings, profile) + if settings.container ~= "" then + msg.warn("The 'container' setting is deprecated, use 'output_format' now") + settings.output_format = settings.output_format .. "." .. settings.container + end + settings.profile = profile + else + settings.profile = "default" + end + start_encoding(from, to, settings) + end +end + +mp.add_key_binding(nil, "set-timestamp", set_timestamp) diff --git a/.config/nvim/lua/user/plugins/dracula.lua b/.config/nvim/lua/user/plugins/dracula.lua index 3d1e91a..77926a0 100644 --- a/.config/nvim/lua/user/plugins/dracula.lua +++ b/.config/nvim/lua/user/plugins/dracula.lua @@ -3,11 +3,11 @@ vim.cmd([[ autocmd! autocmd ColorScheme dracula highlight! link Pmenu DraculaBg autocmd ColorScheme dracula highlight link NormalFloat DraculaBgLight - autocmd ColorScheme dracula highlight FloatBorder guifg=#343746 guibg=#343746 + autocmd ColorScheme dracula highlight FloatBorder guifg=none guibg=none autocmd ColorScheme dracula highlight DraculaBoundary guibg=none autocmd ColorScheme dracula highlight DraculaDiffDelete ctermbg=none guibg=none autocmd ColorScheme dracula highlight DraculaComment cterm=italic gui=italic - autocmd ColorScheme dracula highlight Normal guibg=#000000 + autocmd ColorScheme dracula highlight Normal guibg=none augroup end colorscheme dracula ]]) diff --git a/.config/shell/aliasrc b/.config/shell/aliasrc index 63b4434..93bc200 100644 --- a/.config/shell/aliasrc +++ b/.config/shell/aliasrc @@ -11,6 +11,7 @@ alias mutt='pushd ~/.mutt/attachments; mutt; popd' alias jpwine='LANG=ja_JP.UTF-8 WINEDEBUG=-all wine' alias emacsd='/usr/local/bin/emacs --daemon' alias e="$EDITOR" +alias vi="$EDITOR" alias z='zathura' alias cn='clear;macchina' alias nnn='nnn -Hde' diff --git a/.config/shell/profile b/.config/shell/profile index da7ff8f..a774d0e 100644 --- a/.config/shell/profile +++ b/.config/shell/profile @@ -1,7 +1,7 @@ -umask 0077 +umask 0076 export _JAVA_AWT_WM_NONREPARENTING=1 -export EDITOR="emacsclient -t" +export EDITOR="nvim" export TERMINAL="st" export BROWSER="firefox" -- cgit v1.2.3 From d06a3b3d8996dbccb70490725d8e4a503942a800 Mon Sep 17 00:00:00 2001 From: yuzu-eva Date: Sat, 24 Dec 2022 00:29:06 +0100 Subject: blah --- .config/shell/aliasrc | 2 -- 1 file changed, 2 deletions(-) (limited to '.config/shell/aliasrc') diff --git a/.config/shell/aliasrc b/.config/shell/aliasrc index 93bc200..36c7ab6 100644 --- a/.config/shell/aliasrc +++ b/.config/shell/aliasrc @@ -9,8 +9,6 @@ alias fuck='sudo $(fc -Lln -1)' alias open='xdg-open' alias mutt='pushd ~/.mutt/attachments; mutt; popd' alias jpwine='LANG=ja_JP.UTF-8 WINEDEBUG=-all wine' -alias emacsd='/usr/local/bin/emacs --daemon' -alias e="$EDITOR" alias vi="$EDITOR" alias z='zathura' alias cn='clear;macchina' -- cgit v1.2.3 From aa1f306e5a2bb49022dfcb327100fb71ef10055e Mon Sep 17 00:00:00 2001 From: yuzu-eva Date: Sat, 24 Dec 2022 01:27:45 +0100 Subject: updated aliases --- .config/shell/aliasrc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to '.config/shell/aliasrc') diff --git a/.config/shell/aliasrc b/.config/shell/aliasrc index 36c7ab6..b328c56 100644 --- a/.config/shell/aliasrc +++ b/.config/shell/aliasrc @@ -13,7 +13,7 @@ alias vi="$EDITOR" alias z='zathura' alias cn='clear;macchina' alias nnn='nnn -Hde' -alias freyr='sudo docker run -it --rm -v /hdd/music:/data freyrcli/freyrjs' +alias freyr='sudo docker run -it --rm -v /media/hdd/music:/data freyrcli/freyrjs' # cp mv and rm always verbose alias cp='cp -iv' @@ -62,8 +62,8 @@ date-reverse() { ## DOWNLOADING AND CONVERTING VIDEO # shortcuts for most used yt-dlp settings -alias ytvid='yt-dlp -o "/hdd/vids/random/%(title)s.%(ext)s" --remux-video "mkv"' -alias ytarchive='yt-dlp -o "/hdd/vids/archives/%(uploader)s/%(upload_date)s - %(title)s/%(title)s.%(ext)s" --remux-video "mkv"' +alias ytvid='yt-dlp -o "/media/hdd/vids/random/%(title)s.%(ext)s" --remux-video "mkv"' +alias ytarchive='yt-dlp -o "/media/hdd/vids/archives/%(uploader)s/%(upload_date)s - %(title)s/%(title)s.%(ext)s" --remux-video "mkv"' # convert video files to webm mkwebm() { -- cgit v1.2.3 From 5da0902c8d705b2ad5c0baa7ff62cb459b02ea5e Mon Sep 17 00:00:00 2001 From: yuzu-eva Date: Sat, 24 Dec 2022 14:07:10 +0100 Subject: updated --- .config/mpd/mpd.conf | 12 +++++----- .config/nvim/plugin/packer_compiled.lua | 40 ++++++++++++++++----------------- .config/shell/aliasrc | 6 ++--- .config/shell/profile | 5 ++++- .config/x11/xinitrc | 10 ++++----- .config/zsh/.zshrc | 5 ++++- .ncmpcpp/config | 2 +- 7 files changed, 43 insertions(+), 37 deletions(-) (limited to '.config/shell/aliasrc') diff --git a/.config/mpd/mpd.conf b/.config/mpd/mpd.conf index 1b10341..f409799 100755 --- a/.config/mpd/mpd.conf +++ b/.config/mpd/mpd.conf @@ -1,12 +1,12 @@ -bind_to_address "0.0.0.0" +bind_to_address "127.0.0.1" #bind_to_address "/run/mpd/socket" -music_directory "/hdd/music" +music_directory "/media/hdd/music" playlist_directory "~/.config/mpd/playlists" -db_file "~/.config/mpd/database" -log_file "~/.config/mpd/log" -pid_file "~/.config/mpd/pid" -state_file "~/.config/mpd/mpdstate" +db_file "~/.config/mpd/database" +log_file "~/.config/mpd/log" +pid_file "~/.config/mpd/pid" +state_file "~/.config/mpd/mpdstate" audio_output { type "pipewire" diff --git a/.config/nvim/plugin/packer_compiled.lua b/.config/nvim/plugin/packer_compiled.lua index 75d1f59..6a3d510 100644 --- a/.config/nvim/plugin/packer_compiled.lua +++ b/.config/nvim/plugin/packer_compiled.lua @@ -242,30 +242,38 @@ _G.packer_plugins = { } time([[Defining packer_plugins]], false) --- Config for: nvim-treesitter -time([[Config for nvim-treesitter]], true) -try_loadstring("\27LJ\2\n]\0\0\3\0\4\0\t6\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\0016\0\0\0'\2\3\0B\0\2\1K\0\1\0\28user.plugins.treesitter\nsetup\16spellsitter\frequire\0", "config", "nvim-treesitter") -time([[Config for nvim-treesitter]], false) --- Config for: dracula -time([[Config for dracula]], true) -try_loadstring("\27LJ\2\n4\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\25user.plugins.dracula\frequire\0", "config", "dracula") -time([[Config for dracula]], false) +-- Config for: nvim-ts-autotag +time([[Config for nvim-ts-autotag]], true) +try_loadstring("\27LJ\2\n=\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\20nvim-ts-autotag\frequire\0", "config", "nvim-ts-autotag") +time([[Config for nvim-ts-autotag]], false) +-- Config for: nvim-cmp +time([[Config for nvim-cmp]], true) +try_loadstring("\27LJ\2\n0\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\21user.plugins.cmp\frequire\0", "config", "nvim-cmp") +time([[Config for nvim-cmp]], false) -- Config for: nvim-lspconfig time([[Config for nvim-lspconfig]], true) try_loadstring("\27LJ\2\n6\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\27user.plugins.lspconfig\frequire\0", "config", "nvim-lspconfig") time([[Config for nvim-lspconfig]], false) +-- Config for: dracula +time([[Config for dracula]], true) +try_loadstring("\27LJ\2\n4\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\25user.plugins.dracula\frequire\0", "config", "dracula") +time([[Config for dracula]], false) -- Config for: lualine.nvim time([[Config for lualine.nvim]], true) try_loadstring("\27LJ\2\n4\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\25user.plugins.lualine\frequire\0", "config", "lualine.nvim") time([[Config for lualine.nvim]], false) +-- Config for: nvim-autopairs +time([[Config for nvim-autopairs]], true) +try_loadstring("\27LJ\2\n<\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\19nvim-autopairs\frequire\0", "config", "nvim-autopairs") +time([[Config for nvim-autopairs]], false) -- Config for: nvim-tree.lua time([[Config for nvim-tree.lua]], true) try_loadstring("\27LJ\2\n6\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\27user.plugins.nvim-tree\frequire\0", "config", "nvim-tree.lua") time([[Config for nvim-tree.lua]], false) --- Config for: nvim-ts-autotag -time([[Config for nvim-ts-autotag]], true) -try_loadstring("\27LJ\2\n=\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\20nvim-ts-autotag\frequire\0", "config", "nvim-ts-autotag") -time([[Config for nvim-ts-autotag]], false) +-- Config for: nvim-treesitter +time([[Config for nvim-treesitter]], true) +try_loadstring("\27LJ\2\n]\0\0\3\0\4\0\t6\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\0016\0\0\0'\2\3\0B\0\2\1K\0\1\0\28user.plugins.treesitter\nsetup\16spellsitter\frequire\0", "config", "nvim-treesitter") +time([[Config for nvim-treesitter]], false) -- Config for: LuaSnip time([[Config for LuaSnip]], true) try_loadstring("\27LJ\2\n4\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\25user.plugins.luasnip\frequire\0", "config", "LuaSnip") @@ -274,14 +282,6 @@ time([[Config for LuaSnip]], false) time([[Config for telescope.nvim]], true) try_loadstring("\27LJ\2\n6\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\27user.plugins.telescope\frequire\0", "config", "telescope.nvim") time([[Config for telescope.nvim]], false) --- Config for: nvim-cmp -time([[Config for nvim-cmp]], true) -try_loadstring("\27LJ\2\n0\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\21user.plugins.cmp\frequire\0", "config", "nvim-cmp") -time([[Config for nvim-cmp]], false) --- Config for: nvim-autopairs -time([[Config for nvim-autopairs]], true) -try_loadstring("\27LJ\2\n<\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\19nvim-autopairs\frequire\0", "config", "nvim-autopairs") -time([[Config for nvim-autopairs]], false) _G._packer.inside_compile = false if _G._packer.needs_bufread == true then diff --git a/.config/shell/aliasrc b/.config/shell/aliasrc index b328c56..af0be04 100644 --- a/.config/shell/aliasrc +++ b/.config/shell/aliasrc @@ -1,8 +1,8 @@ ## MISCELLANEOUS # various shortcuts -alias reboot='sudo openrc-shutdown -r' -alias poweroff='sudo openrc-shutdown -p' +alias reboot='sudo reboot' +alias poweroff='sudo poweroff' alias pms='sudo pm-suspend' alias refresh='source $ZDOTDIR/.zshrc' alias fuck='sudo $(fc -Lln -1)' @@ -11,7 +11,7 @@ alias mutt='pushd ~/.mutt/attachments; mutt; popd' alias jpwine='LANG=ja_JP.UTF-8 WINEDEBUG=-all wine' alias vi="$EDITOR" alias z='zathura' -alias cn='clear;macchina' +alias cn='clear;neofetch' alias nnn='nnn -Hde' alias freyr='sudo docker run -it --rm -v /media/hdd/music:/data freyrcli/freyrjs' diff --git a/.config/shell/profile b/.config/shell/profile index a774d0e..ea3879e 100644 --- a/.config/shell/profile +++ b/.config/shell/profile @@ -1,4 +1,4 @@ -umask 0076 +umask 0077 export _JAVA_AWT_WM_NONREPARENTING=1 export EDITOR="nvim" @@ -23,8 +23,11 @@ export QT_IM_MODULE='ibus' export XMODIFIERS='@im=ibus' export XDG_SESSION_TYPE='x11' +export NVM_DIR="$HOME/.config/nvm" + export PATH="$PATH:$HOME/.local/bin:$HOME/.fzf/bin:$HOME/.cargo/bin:/sbin:/usr/sbin" # if [ -z "${DISPLAY}" ] && [ "${XDG_VTNR}" -eq 1 ]; then # exec startx # fi + diff --git a/.config/x11/xinitrc b/.config/x11/xinitrc index cbaec52..b2e6a2a 100644 --- a/.config/x11/xinitrc +++ b/.config/x11/xinitrc @@ -2,8 +2,8 @@ rfkill block all -eval "$(gpg-agent --daemon --allow-preset-passphrase --write-env-file "$envfile")" -eval "$(ssh-agent)" +# eval "$(gpg-agent --daemon --allow-preset-passphrase --write-env-file "$envfile")" +# eval "$(ssh-agent)" xset r rate 300 30 xset s off -dpms @@ -14,13 +14,13 @@ xrandr --auto --output DisplayPort-2 --mode 1600x900 --left-of HDMI-A-0 dbus-launch --sh-syntax --exit-with-session -ibus-daemon -dxrR +# ibus-daemon -dxrR statusbar & pipewire & mpd & -/usr/local/bin/emacs --daemon & +# /usr/local/bin/emacs --daemon & picom & set-wallpaper & -exec dwm >/dev/null 2>&1 +exec dwm diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index ec2f9e0..b63c931 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -84,7 +84,10 @@ setopt pushd_silent setopt pushd_ignore_dups setopt pushd_minus -macchina +neofetch + +[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm +[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion if [ -f $XDG_CONFIG_HOME/.dircolors ]; then eval "$(dircolors -b $XDG_CONFIG_HOME/.dircolors)" diff --git a/.ncmpcpp/config b/.ncmpcpp/config index 763ee0a..6669585 100644 --- a/.ncmpcpp/config +++ b/.ncmpcpp/config @@ -4,7 +4,7 @@ lyrics_directory = ~/.ncmpcpp/lyrics mpd_host = localhost mpd_port = 6600 -mpd_music_dir = /hdd/music +mpd_music_dir = /media/hdd/music mpd_connection_timeout = 5 # Playlist -- cgit v1.2.3 From 66ebf6e1e49075c36ce8e1a3e869985f6b171581 Mon Sep 17 00:00:00 2001 From: yuzu-eva Date: Sun, 25 Dec 2022 23:27:37 +0100 Subject: added http audio output to mpd --- .config/mpd/mpd.conf | 16 ++++++++++++++-- .config/shell/aliasrc | 6 +++++- .config/x11/xinitrc | 4 ++-- .config/zsh/.zshrc | 12 +++++++----- 4 files changed, 28 insertions(+), 10 deletions(-) (limited to '.config/shell/aliasrc') diff --git a/.config/mpd/mpd.conf b/.config/mpd/mpd.conf index f409799..6f04a5d 100755 --- a/.config/mpd/mpd.conf +++ b/.config/mpd/mpd.conf @@ -1,5 +1,5 @@ -bind_to_address "127.0.0.1" -#bind_to_address "/run/mpd/socket" +bind_to_address "0.0.0.0" +#bind_to_address "/run/mpd/socket" music_directory "/media/hdd/music" playlist_directory "~/.config/mpd/playlists" @@ -29,6 +29,16 @@ audio_output { format "44100:16:2" } +audio_output { + type "httpd" + name "My HTTP Stream" + encoder "vorbis" # optional, vorbis or lame + port "8001" + quality "8.0" # do not define if bitrate is defined +# bitrate "256" # do not define if quality is defined + format "44100:16:1" +} + input { enabled "no" plugin "qobuz" @@ -44,3 +54,5 @@ decoder { plugin "wildmidi" config_file "/etc/timidity/timidity.cfg" } + +mixer_type "software" diff --git a/.config/shell/aliasrc b/.config/shell/aliasrc index af0be04..cdc7be8 100644 --- a/.config/shell/aliasrc +++ b/.config/shell/aliasrc @@ -13,7 +13,11 @@ alias vi="$EDITOR" alias z='zathura' alias cn='clear;neofetch' alias nnn='nnn -Hde' -alias freyr='sudo docker run -it --rm -v /media/hdd/music:/data freyrcli/freyrjs' +alias ea='vi ~/.config/shell/aliasrc' +#alias freyr='sudo docker run -it --rm -v /media/hdd/music:/data freyrcli/freyrjs' + +# setting custom ascii +alias neofetch='neofetch --source ~/docs/ascii/lain' # cp mv and rm always verbose alias cp='cp -iv' diff --git a/.config/x11/xinitrc b/.config/x11/xinitrc index b2e6a2a..0c98334 100644 --- a/.config/x11/xinitrc +++ b/.config/x11/xinitrc @@ -2,8 +2,8 @@ rfkill block all -# eval "$(gpg-agent --daemon --allow-preset-passphrase --write-env-file "$envfile")" -# eval "$(ssh-agent)" +eval "$(gpg-agent --daemon --allow-preset-passphrase --write-env-file "$envfile")" +eval "$(ssh-agent)" xset r rate 300 30 xset s off -dpms diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index b63c931..13c6719 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -84,7 +84,6 @@ setopt pushd_silent setopt pushd_ignore_dups setopt pushd_minus -neofetch [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion @@ -97,19 +96,22 @@ if [ -f $XDG_CONFIG_HOME/shell/aliasrc ]; then . $XDG_CONFIG_HOME/shell/aliasrc fi -if [ -f $HOME/.fzf/fzf.zsh ]; then - . $HOME/.fzf/fzf.zsh -fi - +# FZF Section export FZF_DEFAULT_OPS="--extended" export FZF_DEFAULT_COMMAND="fdfind --type f" export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" +if [ -f $HOME/.fzf/fzf.zsh ]; then + . $HOME/.fzf/fzf.zsh +fi + # NNN if [ -f $XDG_CONFIG_HOME/nnn/nnn.bash ]; then . $XDG_CONFIG_HOME/nnn/nnn.bash fi +neofetch + if [ -f $XDG_DATA_HOME/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ]; then . $XDG_DATA_HOME/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh fi -- cgit v1.2.3 From a360f1fc5d89be132044a0aa8f7a8ec4e65a7d95 Mon Sep 17 00:00:00 2001 From: yuzu-eva Date: Tue, 27 Dec 2022 22:25:35 +0100 Subject: fixed color in zsh, sourced Xsession.d in xinitrc, changed clangd command in lspconfig --- .config/mpd/mpd.conf | 26 ++++++++++---------------- .config/nvim/lua/user/plugins/lspconfig.lua | 2 +- .config/shell/aliasrc | 2 +- .config/sxiv/exec/key-handler | 1 + .config/x11/xinitrc | 14 +++++++++----- .config/zsh/.zshrc | 4 +--- 6 files changed, 23 insertions(+), 26 deletions(-) (limited to '.config/shell/aliasrc') diff --git a/.config/mpd/mpd.conf b/.config/mpd/mpd.conf index 6f04a5d..2ebf6b5 100755 --- a/.config/mpd/mpd.conf +++ b/.config/mpd/mpd.conf @@ -8,27 +8,13 @@ log_file "~/.config/mpd/log" pid_file "~/.config/mpd/pid" state_file "~/.config/mpd/mpdstate" +# default local output audio_output { type "pipewire" name "Default" -# sink "alsa_output.pci-0000_29_00.0.analog-stereo" -} - -# For some reason ncmpcpp now switches correctly, so i'm disabling this. -#audio_output { -# type "pulse" -# name "Speakers" -# sink "alsa_output.pci-0000_31_00.4.analog-stereo" -#} -# - -audio_output { - type "fifo" - name "Visualizer feed" - path "/tmp/mpd.fifo" - format "44100:16:2" } +# http streaming audio_output { type "httpd" name "My HTTP Stream" @@ -39,6 +25,14 @@ audio_output { format "44100:16:1" } +# visualizer output +audio_output { + type "fifo" + name "Visualizer feed" + path "/tmp/mpd.fifo" + format "44100:16:2" +} + input { enabled "no" plugin "qobuz" diff --git a/.config/nvim/lua/user/plugins/lspconfig.lua b/.config/nvim/lua/user/plugins/lspconfig.lua index a63975b..92a728b 100644 --- a/.config/nvim/lua/user/plugins/lspconfig.lua +++ b/.config/nvim/lua/user/plugins/lspconfig.lua @@ -115,9 +115,9 @@ require 'lspconfig'.clangd.setup { flags = { debounce_text_changes = 150, }, + cmd = { "/usr/bin/clangd-13" }; } - -- suppress error messages from lang servers vim.notify = function(msg, log_level, _) if msg:match 'exit code' then diff --git a/.config/shell/aliasrc b/.config/shell/aliasrc index cdc7be8..10f32a1 100644 --- a/.config/shell/aliasrc +++ b/.config/shell/aliasrc @@ -14,7 +14,7 @@ alias z='zathura' alias cn='clear;neofetch' alias nnn='nnn -Hde' alias ea='vi ~/.config/shell/aliasrc' -#alias freyr='sudo docker run -it --rm -v /media/hdd/music:/data freyrcli/freyrjs' +alias freyr='sudo docker run -it --rm -v /media/hdd/music:/data freyrcli/freyrjs' # setting custom ascii alias neofetch='neofetch --source ~/docs/ascii/lain' diff --git a/.config/sxiv/exec/key-handler b/.config/sxiv/exec/key-handler index 19bcc67..dcbc60b 100755 --- a/.config/sxiv/exec/key-handler +++ b/.config/sxiv/exec/key-handler @@ -6,5 +6,6 @@ do "C-d") rm "$file" ;; "C-c") cat "$file" | xclip -sel c -t image/png ;; "C-w") xwallpaper --maximize "$file" ;; + "C-z") mv "$file" /media/hdd/pics/wallpaper/ esac done diff --git a/.config/x11/xinitrc b/.config/x11/xinitrc index 0c98334..dc3b2b5 100644 --- a/.config/x11/xinitrc +++ b/.config/x11/xinitrc @@ -1,24 +1,28 @@ #!/bin/sh +if [ -d "/etc/X11/Xsession.d" ]; then + for f in /etc/X11/Xsession.d/*; do + [ -x "$f" ] && . "$f" + done + unset f +fi + rfkill block all eval "$(gpg-agent --daemon --allow-preset-passphrase --write-env-file "$envfile")" -eval "$(ssh-agent)" -xset r rate 300 30 +xset r rate 250 30 xset s off -dpms setxkbmap -option "ctrl:nocaps" xrandr --auto --output HDMI-A-0 --mode 1920x1080 --primary xrandr --auto --output DisplayPort-2 --mode 1600x900 --left-of HDMI-A-0 -dbus-launch --sh-syntax --exit-with-session - # ibus-daemon -dxrR statusbar & +dunst & pipewire & mpd & -# /usr/local/bin/emacs --daemon & picom & set-wallpaper & diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index 13c6719..c5e5f2d 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -1,7 +1,5 @@ autoload -U colors && colors -# PS1="%B%{$fg[red]%}[%{$fg[magenta]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[yellow]%}%~%{$fg[red]%}]%{$reset_color%}$%b " - stty stop undef autoload -U compinit @@ -56,7 +54,7 @@ TRAPINT() { return $(( 128 + $1 )) } -PROMPT='%B%{$fg[red]%}[%{$fg[magenta]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[yellow]%}%~%{$fg[red]%}]%{$reset_color%}%b %(?.%F{green}$THEME_VI_MODE_SYMBOL.%F{red}$THEME_VI_MODE_SYMBOL) ' +PROMPT='%B%{$fg[red]%}[%{$fg[magenta]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[yellow]%}%~%{$fg[red]%}]%b%(?.%F{green}$THEME_VI_MODE_SYMBOL.%F{red}$THEME_VI_MODE_SYMBOL)%{$reset_color%} ' setopt extendedGlob -- cgit v1.2.3 From 5cf8669daf4addb2003f0ca4b362cc7b3c3db38f Mon Sep 17 00:00:00 2001 From: yuzu-eva Date: Wed, 11 Jan 2023 22:46:14 +0100 Subject: i dont even know anymore, i just update this from time to time --- .config/neofetch/config.conf | 2 +- .config/picom/picom.conf | 10 ++++++---- .config/shell/aliasrc | 2 +- .config/shell/profile | 1 - .config/x11/xinitrc | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) (limited to '.config/shell/aliasrc') diff --git a/.config/neofetch/config.conf b/.config/neofetch/config.conf index 0707571..86feaa4 100644 --- a/.config/neofetch/config.conf +++ b/.config/neofetch/config.conf @@ -745,7 +745,7 @@ ascii_distro="auto" # Example: # ascii_colors=(distro) - Ascii is colored based on Distro colors. # ascii_colors=(4 6 1 8 8 6) - Ascii is colored using these colors. -ascii_colors=(distro) +ascii_colors=(15 88 88 88 88 88) # Bold ascii logo # Whether or not to bold the ascii logo. diff --git a/.config/picom/picom.conf b/.config/picom/picom.conf index 08dea69..fa4d989 100644 --- a/.config/picom/picom.conf +++ b/.config/picom/picom.conf @@ -1,6 +1,8 @@ # just very slightly rounded corners -corner-radius = 6 +# empty file, just so transparency works on st -rounded-corners-exclude = [ - "class_g = 'dwm'" -]; +# corner-radius = 6 + +# rounded-corners-exclude = [ +# "class_g = 'dwm'" +# ]; diff --git a/.config/shell/aliasrc b/.config/shell/aliasrc index 10f32a1..7cc0a9d 100644 --- a/.config/shell/aliasrc +++ b/.config/shell/aliasrc @@ -17,7 +17,7 @@ alias ea='vi ~/.config/shell/aliasrc' alias freyr='sudo docker run -it --rm -v /media/hdd/music:/data freyrcli/freyrjs' # setting custom ascii -alias neofetch='neofetch --source ~/docs/ascii/lain' +# alias neofetch='neofetch --source ~/docs/ascii/lain' # cp mv and rm always verbose alias cp='cp -iv' diff --git a/.config/shell/profile b/.config/shell/profile index ea3879e..6cca5f1 100644 --- a/.config/shell/profile +++ b/.config/shell/profile @@ -14,7 +14,6 @@ export ZDOTDIR="$XDG_CONFIG_HOME/zsh" export LC_ALL=en_US.UTF-8 -export STARSHIP_CONFIG=~/.config/starship/starship.toml export MAIL=~/.mutt/Maildir export NO_AT_BRIDGE=1 diff --git a/.config/x11/xinitrc b/.config/x11/xinitrc index dc3b2b5..220c9ff 100644 --- a/.config/x11/xinitrc +++ b/.config/x11/xinitrc @@ -10,6 +10,7 @@ fi rfkill block all eval "$(gpg-agent --daemon --allow-preset-passphrase --write-env-file "$envfile")" +eval "$(ssh-agent)" xset r rate 250 30 xset s off -dpms @@ -20,7 +21,6 @@ xrandr --auto --output DisplayPort-2 --mode 1600x900 --left-of HDMI-A-0 # ibus-daemon -dxrR statusbar & -dunst & pipewire & mpd & picom & -- cgit v1.2.3 From 782ee288d7a60e9f1359d6aa439ddc0f28ed09e6 Mon Sep 17 00:00:00 2001 From: yuzu-eva Date: Fri, 17 Feb 2023 00:03:57 +0100 Subject: add metadata to yt-dlp vids, changed mkwebm video codec, re-added ibus-daemon to xinitrc --- .config/picom/picom.conf | 5 +++++ .config/shell/aliasrc | 39 ++++++++++++++++++++++++++++++++------- .config/x11/xinitrc | 2 +- .config/yt-dlp/config | 2 +- .config/zsh/.zshrc | 1 + 5 files changed, 40 insertions(+), 9 deletions(-) (limited to '.config/shell/aliasrc') diff --git a/.config/picom/picom.conf b/.config/picom/picom.conf index fa4d989..6d3640c 100644 --- a/.config/picom/picom.conf +++ b/.config/picom/picom.conf @@ -1,6 +1,11 @@ # just very slightly rounded corners # empty file, just so transparency works on st +opacity-rule = [ + "90:class_g = 'discord' && focused", + "90:class_g = 'discord' && !focused" +] + # corner-radius = 6 # rounded-corners-exclude = [ diff --git a/.config/shell/aliasrc b/.config/shell/aliasrc index 7cc0a9d..c107f4d 100644 --- a/.config/shell/aliasrc +++ b/.config/shell/aliasrc @@ -14,6 +14,8 @@ alias z='zathura' alias cn='clear;neofetch' alias nnn='nnn -Hde' alias ea='vi ~/.config/shell/aliasrc' +alias setkeys='xset r rate 250 30 && setxkbmap -option "ctrl:nocaps"' +alias cam='mpv --profile=low-latency --untimed /dev/video0' alias freyr='sudo docker run -it --rm -v /media/hdd/music:/data freyrcli/freyrjs' # setting custom ascii @@ -28,10 +30,18 @@ alias mkd='mkdir -pv' # Colorize grep output alias grep='grep --color=auto -i' -# color ls, always full info and human readable; group dirs +# ls shortcuts alias ls='ls -hl --color=always --group-directories-first' alias la='ls -a' +ld() { + if [ "$1" = "" ]; then + ls -d */; + else + ls -d $1/*/ | sed "s|$1/||"; + fi +} + # Control Audio alias headset="wpctl set-default $(wpctl status | grep 'Headphones' | cut -b11-12)" alias speakers="wpctl set-default $(wpctl status | grep 'Speakers' | cut -b11-12)" @@ -45,6 +55,25 @@ alias setlmon-lowres='xrandr --auto --output DisplayPort-2 --mode 640x480 --left alias setlmon-midres='xrandr --auto --output DisplayPort-2 --mode 800x600 --left-of HDMI-A-0' alias setlmon-default='xrandr --auto --output DisplayPort-2 --mode 1600x900 --left-of HDMI-A-0' +# function for timer and stopwatch +timer() { + date1=$((`date +%s` + $1)); + while [ "$date1" -ge `date +%s` ]; do + echo -ne "$(date -u --date @$(($date1 - `date +%s`)) +%H:%M:%S)\r"; + sleep 0.1 + done + notify-send "Time Up"; pw-play "/usr/share/sounds/freedesktop/stereo/complete.oga" +} + +stopwatch() { + date1=`date +%s`; + while true; do + echo -ne "$(date -u --date @$((`date +%s` - $date1)) +%H:%M:%S)\r"; + sleep 0.1 + done +} + + ## FUNCTIONS FOR CONVERTING DATE TO ISO 8601 # convert date from YYYYMMDD to YYYY-MM-DD @@ -63,15 +92,11 @@ date-reverse() { done; } -## DOWNLOADING AND CONVERTING VIDEO - -# shortcuts for most used yt-dlp settings -alias ytvid='yt-dlp -o "/media/hdd/vids/random/%(title)s.%(ext)s" --remux-video "mkv"' -alias ytarchive='yt-dlp -o "/media/hdd/vids/archives/%(uploader)s/%(upload_date)s - %(title)s/%(title)s.%(ext)s" --remux-video "mkv"' +## CONVERTING VIDEO # convert video files to webm mkwebm() { - ffmpeg -i "${1}" -crf 1 -b:v 1M -c:a libvorbis "${1%.*}".webm + ffmpeg -i "${1}" -c:v libvpx-vp9 -crf 1 -b:v 1M -c:a libvorbis "${1%.*}".webm } ## GIT diff --git a/.config/x11/xinitrc b/.config/x11/xinitrc index 220c9ff..d106aa8 100644 --- a/.config/x11/xinitrc +++ b/.config/x11/xinitrc @@ -19,7 +19,7 @@ setxkbmap -option "ctrl:nocaps" xrandr --auto --output HDMI-A-0 --mode 1920x1080 --primary xrandr --auto --output DisplayPort-2 --mode 1600x900 --left-of HDMI-A-0 -# ibus-daemon -dxrR +ibus-daemon -dxrR statusbar & pipewire & mpd & diff --git a/.config/yt-dlp/config b/.config/yt-dlp/config index aeb3bda..e2b5628 100755 --- a/.config/yt-dlp/config +++ b/.config/yt-dlp/config @@ -1 +1 @@ ---verbose -ciw -f bestvideo[ext=mp4][vcodec!*=av01]+bestaudio[ext=m4a]/best[ext=mp4]/best --merge-output-format mkv +--verbose -ciw -f bestvideo[ext=mp4][vcodec!*=av01]+bestaudio[ext=m4a]/best[ext=mp4]/best --add-metadata --merge-output-format mkv diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index c5e5f2d..016a729 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -1,6 +1,7 @@ autoload -U colors && colors stty stop undef +setopt no_nomatch autoload -U compinit zstyle ':completion:*' menu select -- cgit v1.2.3 From be35ccddeb63db26949183ade5a801593918a597 Mon Sep 17 00:00:00 2001 From: yuzu-eva Date: Sat, 1 Apr 2023 15:59:07 +0200 Subject: removed emacs configs --- .config/nvim/snippets/all.lua | 23 +++ .config/nvim/snippets/html.lua | 20 --- .config/picom/picom.conf | 4 +- .config/shell/aliasrc | 3 + .config/x11/xinitrc | 1 + .emacs.d/config.el | 87 ---------- .emacs.d/dracula-custom-theme.el | 52 ------ .emacs.d/functions.el | 49 ------ .emacs.d/init.el | 14 -- .emacs.d/keybinds.el | 14 -- .emacs.d/packages.el | 335 --------------------------------------- 11 files changed, 29 insertions(+), 573 deletions(-) create mode 100644 .config/nvim/snippets/all.lua delete mode 100644 .config/nvim/snippets/html.lua delete mode 100644 .emacs.d/config.el delete mode 100644 .emacs.d/dracula-custom-theme.el delete mode 100644 .emacs.d/functions.el delete mode 100644 .emacs.d/init.el delete mode 100644 .emacs.d/keybinds.el delete mode 100644 .emacs.d/packages.el (limited to '.config/shell/aliasrc') diff --git a/.config/nvim/snippets/all.lua b/.config/nvim/snippets/all.lua new file mode 100644 index 0000000..78c33db --- /dev/null +++ b/.config/nvim/snippets/all.lua @@ -0,0 +1,23 @@ +return { + parse('sktn', '\ +\ +\ +\ + Website Title\ + \ + \ + \ +\ +\ +\ +
\ +

Header Text

\ +
\ +
\ +

Lorem ipsum bla, bla, bla...

\ +
\ +\ +\ +\ +'), +} diff --git a/.config/nvim/snippets/html.lua b/.config/nvim/snippets/html.lua deleted file mode 100644 index b168aca..0000000 --- a/.config/nvim/snippets/html.lua +++ /dev/null @@ -1,20 +0,0 @@ -return { - parse('sktn', '\ -\ -\ -\ - \ - \ - \ - \ -\ -\ -\ -
\ -

\ -
\ -\ -\ -\ -'), -} diff --git a/.config/picom/picom.conf b/.config/picom/picom.conf index f3eb671..a095613 100644 --- a/.config/picom/picom.conf +++ b/.config/picom/picom.conf @@ -2,8 +2,8 @@ # empty file, just so transparency works on st opacity-rule = [ - "90:class_g = 'SchildiChat' && focused", - "90:class_g = 'SchildiChat' && !focused" + "98:class_g = 'SchildiChat' && focused", + "98:class_g = 'SchildiChat' && !focused" ] # corner-radius = 6 diff --git a/.config/shell/aliasrc b/.config/shell/aliasrc index c107f4d..5d21bf7 100644 --- a/.config/shell/aliasrc +++ b/.config/shell/aliasrc @@ -10,6 +10,8 @@ alias open='xdg-open' alias mutt='pushd ~/.mutt/attachments; mutt; popd' alias jpwine='LANG=ja_JP.UTF-8 WINEDEBUG=-all wine' alias vi="$EDITOR" +alias em='emacsclient -c -a "emacs" &' +alias emacsd='/usr/local/bin/emacs --daemon &' alias z='zathura' alias cn='clear;neofetch' alias nnn='nnn -Hde' @@ -17,6 +19,7 @@ alias ea='vi ~/.config/shell/aliasrc' alias setkeys='xset r rate 250 30 && setxkbmap -option "ctrl:nocaps"' alias cam='mpv --profile=low-latency --untimed /dev/video0' alias freyr='sudo docker run -it --rm -v /media/hdd/music:/data freyrcli/freyrjs' +alias ofn='/usr/bin/ls | cat -n | while read n f; do rename "s/${f%.*}/$(printf "%04d" "$n")/" "$f"; done' # setting custom ascii # alias neofetch='neofetch --source ~/docs/ascii/lain' diff --git a/.config/x11/xinitrc b/.config/x11/xinitrc index d106aa8..76a3ff5 100644 --- a/.config/x11/xinitrc +++ b/.config/x11/xinitrc @@ -20,6 +20,7 @@ xrandr --auto --output HDMI-A-0 --mode 1920x1080 --primary xrandr --auto --output DisplayPort-2 --mode 1600x900 --left-of HDMI-A-0 ibus-daemon -dxrR +/usr/local/bin/emacs --daemon & statusbar & pipewire & mpd & diff --git a/.emacs.d/config.el b/.emacs.d/config.el deleted file mode 100644 index a46bca5..0000000 --- a/.emacs.d/config.el +++ /dev/null @@ -1,87 +0,0 @@ -(add-hook 'text-mode-hook 'display-line-numbers-mode) -(add-hook 'prog-mode-hook 'display-line-numbers-mode) -(add-hook 'emacs-startup-hook 'startup/revert-file-name-handler-alist) -(add-hook 'emacs-startup-hook 'startup/reset-gc) - -;; dirty fix for having AC everywhere -(define-globalized-minor-mode real-global-auto-complete-mode - auto-complete-mode (lambda () - (if (not (minibufferp (current-buffer))) - (auto-complete-mode 1)) - )) -(real-global-auto-complete-mode t) - -;; Mutt support -(add-to-list 'auto-mode-alist '("/tmp/mutt.*" . mail-mode)) - -(show-paren-mode 1) -(tool-bar-mode -1) -(menu-bar-mode -1) -(scroll-bar-mode -1) -(global-prettify-symbols-mode t) -(electric-pair-mode t) -(global-hl-line-mode t) -(recentf-mode 1) -(savehist-mode 1) -(global-auto-revert-mode 1) - -(set-frame-parameter (selected-frame) 'alpha '(80 . 80)) -(add-to-list 'default-frame-alist '(alpha .(80 . 80))) - -(defvar startup/file-name-handler-alist file-name-handler-alist) - -(defalias 'open 'find-file-other-window) -(defalias 'clean 'eshell/clear-scrollback) -(defalias 'yes-or-no-p 'y-or-n-p) - -;; Make emacs startup faster -(setq gc-cons-threshold 402653184 - gc-cons-percentage 0.6) - -(setq-default major-mode 'text-mode) - -(setq inhibit-startup-message t) -(setq x-select-enable-clipboard t) -(setq make-backup-files nil) -(setq scroll-conservatively 100) -(setq ring-bell-function 'ignore) -(setq history-length 25) -(setq global-auto-revert-non-file-buffers t) -(setq native-comp-async-report-warnings-errors 'silent) -(setq warning-minimum-level :error) - -(setq-default tab-width 4) -(setq-default standard-indent 4) -(setq c-basic-offset tab-width) -(setq-default electric-indent-inhibit t) -(setq-default indent-tabs-mode t) -(setq backward-delete-char-untabify-method 'nil) - - -(setq electric-pair-pairs '( - (?\{ . ?\}) - (?\( . ?\)) - (?\[ . ?\]) - (?\" . ?\") - )) - -(setq use-package-always-defer t) - -(setq eshell-prompt-regexp "^[^αλ\n]*[αλ] ") -(setq eshell-prompt-function - (lambda nil - (concat - (if (string= (eshell/pwd) (getenv "HOME")) - (propertize "~" 'face `(:foreground "#99CCFF")) - (replace-regexp-in-string - (getenv "HOME") - (propertize "~" 'face `(:foreground "#99CCFF")) - (propertize (eshell/pwd) 'face `(:foreground "#99CCFF")))) - (if (= (user-uid) 0) - (propertize " α " 'face `(:foreground "#FF6666")) - (propertize " λ " 'face `(:foreground "#A6E22E")))))) - -(setq eshell-highlight-prompt nil) -(setq file-name-handler-alist nil) - -(setq initial-buffer-choice (lambda () (get-buffer "*dashboard*"))) diff --git a/.emacs.d/dracula-custom-theme.el b/.emacs.d/dracula-custom-theme.el deleted file mode 100644 index ee96b4c..0000000 --- a/.emacs.d/dracula-custom-theme.el +++ /dev/null @@ -1,52 +0,0 @@ -(deftheme dracula-custom - "Created 2022-11-27.") - -(custom-theme-set-faces - 'dracula-custom - '(cursor ((t (:background "#ccccc7")))) - '(fixed-pitch ((t (:family "Monospace")))) - '(variable-pitch ((((type w32)) (:foundry "outline" :family "Arial")) (t (:family "Sans Serif")))) - '(escape-glyph ((((background dark)) (:foreground "cyan")) (((type pc)) (:foreground "magenta")) (t (:foreground "brown")))) - '(homoglyph ((((background dark)) (:foreground "cyan")) (((type pc)) (:foreground "magenta")) (t (:foreground "brown")))) - '(minibuffer-prompt ((t (:weight bold :foreground "#ff79c6")))) - '(highlight ((t (:foreground "#ccccc7" :background "#464752")))) - '(region ((t (:extend t :inherit (match))))) - '(shadow ((t (:foreground "#6272a4")))) - '(secondary-selection ((((class color) (min-colors 88) (background light)) (:extend t :background "yellow1")) (((class color) (min-colors 88) (background dark)) (:extend t :background "SkyBlue4")) (((class color) (min-colors 16) (background light)) (:extend t :background "yellow")) (((class color) (min-colors 16) (background dark)) (:extend t :background "SkyBlue4")) (((class color) (min-colors 8)) (:extend t :foreground "black" :background "cyan")) (t (:inverse-video t)))) - '(trailing-whitespace ((t (:background "#ffb86c")))) - '(font-lock-builtin-face ((t (:slant italic :foreground "#8be9fd")))) - '(font-lock-comment-delimiter-face ((t (:inherit (shadow))))) - '(font-lock-comment-face ((t (:inherit (shadow))))) - '(font-lock-constant-face ((t (:foreground "#bd93f9")))) - '(font-lock-doc-face ((t (:foreground "#6272a4")))) - '(font-lock-doc-markup-face ((t (:inherit (font-lock-constant-face))))) - '(font-lock-function-name-face ((t (:weight bold :foreground "#50fa7b")))) - '(font-lock-keyword-face ((t (:foreground "#ff79c6" :weight bold)))) - '(font-lock-negation-char-face ((t (:foreground "#8be9fd")))) - '(font-lock-preprocessor-face ((t (:foreground "#ffb86c")))) - '(font-lock-regexp-grouping-backslash ((t (:foreground "#8be9fd")))) - '(font-lock-regexp-grouping-construct ((t (:foreground "#bd93f9")))) - '(font-lock-string-face ((t (:foreground "#f1fa8c")))) - '(font-lock-type-face ((t (:inherit (font-lock-builtin-face))))) - '(font-lock-variable-name-face ((t (:foreground "#d8a5f8" :weight bold)))) - '(font-lock-warning-face ((t (:background "#373844" :inherit (warning))))) - '(button ((t (:inherit (link))))) - '(link ((t (:underline (:color foreground-color :style line) :foreground "#8be9fd")))) - '(link-visited ((default (:inherit (link))) (((class color) (background light)) (:foreground "magenta4")) (((class color) (background dark)) (:foreground "violet")))) - '(fringe ((t (:foreground "#b6b6b2" :background "#282a36")))) - '(header-line ((t (:inherit 'mode-line)))) - '(tooltip ((t (:foreground "#f8f8f2" :background "#44475a")))) - '(mode-line ((t (:box (:line-width (1 . 1) :color "#44475a" :style nil) :inverse-video nil :foreground "#f8f8f2" :background "#44475a")))) - '(mode-line-buffer-id ((t (:weight bold)))) - '(mode-line-emphasis ((t (:weight bold)))) - '(mode-line-highlight ((((supports :box t) (class color) (min-colors 88)) (:box (:line-width (2 . 2) :color "grey40" :style released-button))) (t (:inherit (highlight))))) - '(mode-line-inactive ((t (:box (:line-width (1 . 1) :color "#373844" :style nil) :inverse-video nil :foreground "#b6b6b2" :background "#282a36")))) - '(isearch ((t (:weight bold :inherit (match))))) - '(isearch-fail ((t (:foreground "#282a36" :background "#ffb86c")))) - '(lazy-highlight ((t (:foreground "#e2e2dc" :background "#373844")))) - '(match ((t (:foreground "#282a36" :background "#f1fa8c")))) - '(next-error ((t (:inherit (region))))) - '(query-replace ((t (:inherit (isearch))))) - '(default ((t (:family "Hack Nerd Font" :foundry "SRC" :width normal :height 113 :weight normal :slant normal :underline nil :overline nil :extend nil :strike-through nil :box nil :inverse-video nil :foreground "#F8F8F2" :background "#262626" :stipple nil :inherit nil))))) - -(provide-theme 'dracula-custom) diff --git a/.emacs.d/functions.el b/.emacs.d/functions.el deleted file mode 100644 index cc86002..0000000 --- a/.emacs.d/functions.el +++ /dev/null @@ -1,49 +0,0 @@ -(defun startup/revert-file-name-handler-alist () - (setq file-name-handler-alist startup/file-name-handler-alist)) - -(defun startup/reset-gc () - (setq gc-cons-threshold 16777216 - gc-cons-percentage 0.1)) - -(defun split-and-follow-horizontally () - (interactive) - (split-window-below) - (balance-windows) - (other-window 1)) - -(defun split-and-follow-vertically () - (interactive) - (split-window-right) - (balance-windows) - (other-window 1)) - -(defun toggle-transparency() - (interactive) - (let ((alpha (frame-parameter nil 'alpha))) - (set-frame-parameter - nil 'alpha - (if (eql (cond ((numberp alpha) alpha) - ((numberp (cdr alpha)) (cdr alpha)) - ;; Also handle undocumented ( ) form. - ((numberp (cadr alpha)) (cadr alpha))) - 100) - '(80 . 80) '(100 . 100))))) - -(defun eshell/sudo-open (filename) - "Open a file as root in Eshell." - (let ((qual-filename (if (string-match "^/" filename) - filename - (concat (expand-file-name (eshell/pwd)) "/" filename)))) - (switch-to-buffer - (find-file-noselect - (concat "/sudo::" qual-filename))))) - -(defun eshell-other-window () - "Create or visit an eshell buffer." - (interactive) - (if (not (get-buffer "*eshell*")) - (progn - (split-window-sensibly (selected-window)) - (other-window 1) - (eshell)) - (switch-to-buffer-other-window "*eshell*"))) diff --git a/.emacs.d/init.el b/.emacs.d/init.el deleted file mode 100644 index 6079b3d..0000000 --- a/.emacs.d/init.el +++ /dev/null @@ -1,14 +0,0 @@ -(load "~/.emacs.d/packages" nil t) -(load "~/.emacs.d/functions" nil t) -(load "~/.emacs.d/keybinds" nil t) -(load "~/.emacs.d/config" nil t) - -(server-start) -(set-default-file-modes #o700) - -;; Load Witchmacs theme -(load-theme 'Witchmacs t) - -;; Move customization variables to a separate file and load it -(setq custom-file (locate-user-emacs-file "custom-vars.el")) -(load custom-file 'noerror 'nomessage) diff --git a/.emacs.d/keybinds.el b/.emacs.d/keybinds.el deleted file mode 100644 index e0fa2ed..0000000 --- a/.emacs.d/keybinds.el +++ /dev/null @@ -1,14 +0,0 @@ -;; Control X -(global-set-key (kbd "C-x 2") 'split-and-follow-horizontally) -(global-set-key (kbd "C-x 3") 'split-and-follow-vertically) - -;; Super -(global-set-key (kbd "s-C-") 'shrink-window-horizontally) -(global-set-key (kbd "s-C-") 'enlarge-window-horizontally) -(global-set-key (kbd "s-C-") 'shrink-window) -(global-set-key (kbd "s-C-") 'enlarge-window) -(global-set-key (kbd "") 'eshell-other-window) - -;; Control C -(global-set-key (kbd "C-c r") 'recentf-open-files) -(global-set-key (kbd "C-c t") 'toggle-transparency) diff --git a/.emacs.d/packages.el b/.emacs.d/packages.el deleted file mode 100644 index 9abae55..0000000 --- a/.emacs.d/packages.el +++ /dev/null @@ -1,335 +0,0 @@ -;; Initialize melpa repo -(require 'package) -(setq package-enable-at-startup nil) -(add-to-list 'package-archives - '("melpa" . "https://melpa.org/packages/")) -(package-initialize) - -;; Initialize use-package -(unless (package-installed-p 'use-package) - (package-refresh-contents) - (package-install 'use-package)) -(use-package org - :config - (add-hook 'org-mode-hook 'org-indent-mode) - (add-hook 'org-mode-hook - (lambda () - (visual-line-mode 1)))) - -(use-package org-indent - :diminish org-indent-mode) - -(use-package htmlize - :ensure t) - -(use-package auto-package-update - :defer nil - :ensure t - :config - (setq auto-package-update-delete-old-versions t) - (setq auto-package-update-hide-results t) - (auto-package-update-maybe)) - -(use-package diminish - :ensure t) - -(use-package spaceline - :ensure t) - -(use-package powerline - :ensure t - :init - (spaceline-spacemacs-theme) - :hook - ('after-init-hook) . 'powerline-reset) - -(use-package dashboard - :ensure t - :defer nil - :preface - (defun update-config () - "Update Witchmacs to the latest version." - (interactive) - (let ((dir (expand-file-name user-emacs-directory))) - (if (file-exists-p dir) - (progn - (message "Witchmacs is updating!") - (cd dir) - (shell-command "git pull") - (message "Update finished. Switch to the messages buffer to see changes and then restart Emacs")) - (message "\"%s\" doesn't exist." dir)))) - - (defun create-scratch-buffer () - "Create a scratch buffer" - (interactive) - (switch-to-buffer (get-buffer-create "*scratch*")) - (lisp-interaction-mode)) - :config - (dashboard-setup-startup-hook) - (setq dashboard-items '((recents . 5))) - (setq dashboard-banner-logo-title "W I T C H M A C S - The cutest Emacs distribution!") - (setq dashboard-startup-banner "~/.emacs.d/marivector.png") - (setq dashboard-center-content t) - (setq dashboard-show-shortcuts nil) - (setq dashboard-set-init-info t) - (setq dashboard-init-info (format "%d packages loaded in %s" - (length package-activated-list) (emacs-init-time))) - (setq dashboard-set-footer nil) - (setq dashboard-set-navigator t) - (setq dashboard-navigator-buttons - `(;; line1 - ((,nil - "Witchmacs on github" - "Open Witchmacs' github page on your browser" - (lambda (&rest _) (browse-url "https://github.com/snackon/witchmacs")) - 'default) - (nil - "Witchmacs crash course" - "Open Witchmacs' introduction to Emacs" - (lambda (&rest _) (find-file "~/.emacs.d/Witcheat.org")) - 'default) - (nil - "Update Witchmacs" - "Get the latest Witchmacs update. Check out the github commits for changes!" - (lambda (&rest _) (update-config)) - 'default) - ) - ;; line 2 - ((,nil - "Open scratch buffer" - "Switch to the scratch buffer" - (lambda (&rest _) (create-scratch-buffer)) - 'default) - (nil - "Open config.el" - "Open Witchmacs' configuration file for easy editing" - (lambda (&rest _) (find-file "~/.emacs.d/config.el")) - 'default) - (nil - "Open init.el" - "Open init file" - (lambda (&rest _) (find-file "~/.emacs.d/init.el")) - 'default))))) - - -;(insert (concat -; (propertize (format "%d packages loaded in %s" -; (length package-activated-list) (emacs-init-time)) -; 'face 'font-lock-comment-face))) -; -;(dashboard-center-line) - -(use-package which-key - :ensure t - :diminish which-key-mode - :init - (which-key-mode)) - -(use-package swiper - :ensure t - :bind ("C-s" . 'swiper)) - -(use-package evil - :ensure t - :defer nil - :init - (setq evil-want-keybinding nil) - (setq evil-want-C-u-scroll t) - :config - (evil-mode 1)) - -;(use-package evil-collection -; :after evil -; :ensure t -; :config -; (evil-collection-init)) - -(use-package beacon - :ensure t - :diminish beacon-mode - :init - (beacon-mode 1)) - -(use-package avy - :ensure t - :bind - ("M-s" . avy-goto-char)) - -(use-package switch-window - :ensure t - :config - (setq switch-window-input-style 'minibuffer) - (setq switch-window-increase 4) - (setq switch-window-threshold 2) - (setq switch-window-shortcut-style 'qwerty) - (setq switch-window-qwerty-shortcuts - '("a" "s" "d" "f" "j" "k" "l")) - :bind - ([remap other-window] . switch-window)) - -(use-package ido - :init - (ido-mode 1) - :config - (setq ido-enable-flex-matching nil) - (setq ido-create-new-buffer 'always) - (setq ido-everywhere t)) - -(use-package ido-vertical-mode - :ensure t - :init - (ido-vertical-mode 1)) -; This enables arrow keys to select while in ido mode. If you want to -; instead use the default Emacs keybindings, change it to -; "'C-n-and-C-p-only" -(setq ido-vertical-define-keys 'C-n-C-p-up-and-down) - -(use-package async - :ensure t - :init - (dired-async-mode 1)) - -(use-package page-break-lines - :ensure t - :diminish (page-break-lines-mode visual-line-mode)) - -(use-package undo-tree - :ensure t - :diminish undo-tree-mode) - -(use-package treemacs - :ensure t - :defer t - :init - (with-eval-after-load 'winum - (define-key winum-keymap (kbd "M-0") #'treemacs-select-window)) - :config - (progn - (setq treemacs-collapse-dirs (if (executable-find "python3") 3 0) - treemacs-deferred-git-apply-delay 0.5 - treemacs-display-in-side-window t - treemacs-eldoc-display t - treemacs-file-event-delay 5000 - treemacs-file-follow-delay 0.2 - treemacs-follow-after-init t - treemacs-git-command-pipe "" - treemacs-goto-tag-strategy 'refetch-index - treemacs-indentation 2 - treemacs-indentation-string " " - treemacs-is-never-other-window nil - treemacs-max-git-entries 5000 - treemacs-missing-project-action 'ask - treemacs-no-png-images nil - treemacs-no-delete-other-windows t - treemacs-project-follow-cleanup nil - treemacs-persist-file (expand-file-name ".cache/treemacs-persist" user-emacs-directory) - treemacs-recenter-distance 0.1 - treemacs-recenter-after-file-follow nil - treemacs-recenter-after-tag-follow nil - treemacs-recenter-after-project-jump 'always - treemacs-recenter-after-project-expand 'on-distance - treemacs-show-cursor nil - treemacs-show-hidden-files t - treemacs-silent-filewatch nil - treemacs-silent-refresh nil - treemacs-sorting 'alphabetic-desc - treemacs-space-between-root-nodes t - treemacs-tag-follow-cleanup t - treemacs-tag-follow-delay 1.5 - treemacs-width 30) - (treemacs-resize-icons 11) - - (treemacs-follow-mode t) - (treemacs-filewatch-mode t) - (treemacs-fringe-indicator-mode t) - (pcase (cons (not (null (executable-find "git"))) - (not (null (executable-find "python3")))) - (`(t . t) - (treemacs-git-mode 'deferred)) - (`(t . _) - (treemacs-git-mode 'simple)))) - :bind - (:map global-map - ("M-0" . treemacs-select-window) - ("C-x t 1" . treemacs-delete-other-windows) - ("C-x t t" . treemacs) - ("C-x t B" . treemacs-bookmark) - ("C-x t C-t" . treemacs-find-file) - ("C-x t M-t" . treemacs-find-tag))) - -(use-package treemacs-evil - :after treemacs evil - :ensure t) - - (use-package treemacs-icons-dired - :after treemacs dired - :ensure t - :config (treemacs-icons-dired-mode)) - -(use-package magit - :ensure t) - -(use-package eldoc - :diminish eldoc-mode) - -(use-package abbrev - :diminish abbrev-mode) - -(use-package company - :ensure t - :diminish (meghanada-mode company-mode irony-mode) - :config - (setq company-idle-delay 0) - (setq company-minimum-prefix-length 3) - (define-key company-active-map (kbd "M-n") nil) - (define-key company-active-map (kbd "M-p") nil) - (define-key company-active-map (kbd "C-n") #'company-select-next) - (define-key company-active-map (kbd "C-p") #'company-select-previous) - (define-key company-active-map (kbd "SPC") #'company-abort) - :hook - ((java-mode c-mode c++-mode) . company-mode)) - -(use-package yasnippet - :ensure t - :diminish yas-minor-mode - :hook - ((c-mode c++-mode) . yas-minor-mode) - :config - (yas-reload-all)) - -(use-package yasnippet-snippets - :ensure t) - -(use-package company-c-headers - :defer nil - :ensure t) - -(use-package company-irony - :defer nil - :ensure t - :config - (setq company-backends '((company-c-headers - company-dabbrev-code - company-irony)))) -(use-package irony - :defer nil - :ensure t - :config - :hook - ((c++-mode c-mode) . irony-mode) - ('irony-mode-hook) . 'irony-cdb-autosetup-compile-options) - -(use-package meghanada - :ensure t - :defer nil - :config - (add-hook 'java-mode-hook - (lambda () - (meghanada-mode t))) - (setq meghanada-java-path "java") - (setq meghanada-maven-path "mvn")) - -(use-package evil-surround - :ensure t - :config - (global-evil-surround-mode 1)) -- cgit v1.2.3