diff options
| author | yuzu-eva <stevenhu@web.de> | 2023-04-01 19:12:44 +0200 |
|---|---|---|
| committer | yuzu-eva <stevenhu@web.de> | 2023-04-01 19:12:44 +0200 |
| commit | ccba79d7f97140a325af7b98b8ce2917e7cf4fc8 (patch) | |
| tree | 2b3ff294f2ab915a08916125a9e4fd2c3fa126ac | |
| parent | 39e9d4e4f740647e49cf7f2f090bc0ddb27a7d76 (diff) | |
| parent | be35ccddeb63db26949183ade5a801593918a597 (diff) | |
merge desktop into master
31 files changed, 1943 insertions, 204 deletions
diff --git a/.config/mpd/mpd.conf b/.config/mpd/mpd.conf index 3a6a57d..2ebf6b5 100755 --- a/.config/mpd/mpd.conf +++ b/.config/mpd/mpd.conf @@ -1,25 +1,31 @@ -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 "/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" +# default local output audio_output { - type "pulse" - name "Headphone" - sink "alsa_output.pci-0000_29_00.0.analog-stereo" + type "pipewire" + name "Default" } +# http streaming audio_output { - type "pulse" - name "Speakers" - sink "alsa_output.pci-0000_31_00.4.analog-stereo" + 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" } +# visualizer output audio_output { type "fifo" name "Visualizer feed" @@ -42,3 +48,5 @@ decoder { plugin "wildmidi" config_file "/etc/timidity/timidity.cfg" } + +mixer_type "software" 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..93dbb74 --- /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:v libvpx-vp9 -b:v 800k -c:a libvorbis + +# 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/neofetch/config.conf b/.config/neofetch/config.conf index b1cbba8..149ab2e 100644 --- a/.config/neofetch/config.conf +++ b/.config/neofetch/config.conf @@ -1,42 +1,31 @@ -# See this wiki page for more info: +# See this wiki page for more info # https://github.com/dylanaraps/neofetch/wiki/Customizing-Info print_info() { info title - info underline - - info "OS" distro - info "Host" model - info "Kernel" kernel - info "Uptime" uptime - info "Packages" packages - info "Shell" shell - info "Resolution" resolution - info "DE" de - info "WM" wm - info "WM Theme" wm_theme - # info "Theme" theme - # info "Icons" icons - info "Terminal" term - # info "Terminal Font" term_font - info "CPU" cpu - info "GPU" gpu - info "Memory" memory - - # info "GPU Driver" gpu_driver # Linux/macOS only - # info "CPU Usage" cpu_usage - # info "Disk" disk - # info "Battery" battery - # info "Font" font - # info "Song" song - # [[ "$player" ]] && prin "Music Player" "$player" - # info "Local IP" local_ip - # info "Public IP" public_ip - # info "Users" users - # info "Locale" locale # This only works on glibc systems. - - info cols + # prin "\n \n " "$(curl wttr.in/?0?q?T | awk '/°(C|F)/ {printf $(NF-1) $(NF) " ("a")"} /,/ {a=$0}')" + prin "${cl9}┌────────────────────────────────────────────────────┐" + info "\n \n " distro + info "\n \n " model + info "\n \n " kernel + info "\n \n " uptime + info "\n \n " packages + info "\n \n " shell + info "\n \n " resolution + info "\n \n " wm + info "\n \n " term + info "\n \n " cpu + info "\n \n " gpu + info "\n \n " memory + info "\n \n " disk + prin "${cl9}└─────────────────────────────────── $(color 1) $(color 2) $(color 3) $(color 4) $(color 5) $(color 6) $(color 7) $(color 8) ${cl9}┘" + prin "\n" } +reset="\033[0m" + +cl9="${reset}" + + # Title @@ -85,7 +74,7 @@ distro_shorthand="off" # Example: # on: 'Arch Linux x86_64' # off: 'Arch Linux' -os_arch="on" +os_arch="off" # Uptime @@ -101,7 +90,7 @@ os_arch="on" # on: '2 days, 10 hours, 3 mins' # tiny: '2d 10h 3m' # off: '2 days, 10 hours, 3 minutes' -uptime_shorthand="on" +uptime_shorthand="tiny" # Memory @@ -116,7 +105,7 @@ uptime_shorthand="on" # Example: # on: '1801MiB / 7881MiB (22%)' # off: '1801MiB / 7881MiB' -memory_percent="off" +memory_percent="on" # Packages @@ -183,7 +172,7 @@ speed_type="bios_limit" # Example: # on: 'i7-6500U (4) @ 3.1GHz' # off: 'i7-6500U (4) @ 3.100GHz' -speed_shorthand="off" +speed_shorthand="on" # Enable/Disable CPU brand in output. # @@ -286,7 +275,7 @@ gpu_type="all" # Example: # on: '1920x1080 @ 60Hz' # off: '1920x1080' -refresh_rate="on" +refresh_rate="off" # Gtk Theme / Icons / Font @@ -313,7 +302,7 @@ gtk_shorthand="off" # Example: # on: 'Numix [GTK2], Adwaita [GTK3]' # off: 'Adwaita [GTK3]' -gtk2="on" +gtk2="off" # Enable/Disable gtk3 Theme / Icons / Font # @@ -324,7 +313,7 @@ gtk2="on" # Example: # on: 'Numix [GTK2], Adwaita [GTK3]' # off: 'Numix [GTK2]' -gtk3="on" +gtk3="off" # IP Address @@ -335,14 +324,14 @@ gtk3="on" # Default: 'http://ident.me' # Values: 'url' # Flag: --ip_host -public_ip_host="http://ident.me" +# public_ip_host="http://ident.me" # Public IP timeout. # # Default: '2' # Values: 'int' # Flag: --ip_timeout -public_ip_timeout=2 +# public_ip_timeout=2 # Desktop Environment @@ -353,7 +342,7 @@ public_ip_timeout=2 # Default: 'off' # Values: 'on', 'off' # Flag: --de_version -de_version="off" +# de_version="off" # Disk @@ -375,7 +364,7 @@ de_version="off" # disk_show=('/'): # 'Disk (/): 74G / 118G (66%)' # -disk_show=('/') +disk_show=('/' '/home' '/dev/sda2' '/dev/sdb1') # Disk subtitle. # What to append to the Disk subtitle. @@ -399,7 +388,7 @@ disk_show=('/') # none: 'Disk: 74G / 118G (66%)' # 'Disk: 74G / 118G (66%)' # 'Disk: 74G / 118G (66%)' -disk_subtitle="mount" +disk_subtitle="none" # Disk percent. # Show/Hide disk percent. @@ -511,7 +500,7 @@ mpc_args=() # Example: # colors=(distro) - Text is colored based on Distro colors. # colors=(4 6 1 8 8 6) - Text is colored in the order above. -colors=(5 5 93 5 15 15) +colors=(201 51 93 5 7 7) # Text Options @@ -548,7 +537,7 @@ underline_char="-" # Example: # separator="->": 'Shell-> bash' # separator=" =": 'WM = dwm' -separator=":" +separator=" " # Color Blocks @@ -756,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=(88 88 88 88 88 88) # Bold ascii logo # Whether or not to bold the ascii logo. 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/nvim/lua/user/plugins/lspconfig.lua b/.config/nvim/lua/user/plugins/lspconfig.lua index 1f6e642..1351959 100644 --- a/.config/nvim/lua/user/plugins/lspconfig.lua +++ b/.config/nvim/lua/user/plugins/lspconfig.lua @@ -48,34 +48,7 @@ local on_attach = function(_, bufnr) end -- provide additional completion capabilities -local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) - -require 'lspconfig'.eslint.setup { - on_attach = on_attach, - capabilities = capabilities, - flags = { - debounce_text_changes = 150, - }, - handlers = { - ['window/showMessageRequest'] = function(_, result, _) return result end, - }, -} - -require 'lspconfig'.tsserver.setup { - on_attach = on_attach, - capabilities = capabilities, - flags = { - debounce_text_changes = 150, - } -} - -require 'lspconfig'.html.setup { - on_attach = on_attach, - capabilities = capabilities, - flags = { - debounce_text_changes = 150, - } -} +local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities()) require 'lspconfig'.emmet_ls.setup { on_attach = on_attach, @@ -83,13 +56,13 @@ require 'lspconfig'.emmet_ls.setup { flags = { debounce_text_changes = 150, }, - filetypes = { 'html', 'javascript', 'typescript', 'javascriptreact', 'typescriptreact' } + filetypes = { 'html', 'javascript', 'typescript', 'javascriptreact', 'typescriptreact', 'eruby' } } local runtime_path = vim.split(package.path, ';') table.insert(runtime_path, "lua/?.lua") table.insert(runtime_path, "lua/?/init.lua") -require 'lspconfig'.sumneko_lua.setup { +require 'lspconfig'.lua_ls.setup { on_attach = on_attach, capabilities = capabilities, flags = { @@ -120,22 +93,15 @@ require 'lspconfig'.sumneko_lua.setup { }, } -require 'lspconfig'.solargraph.setup { +require 'lspconfig'.bashls.setup { on_attach = on_attach, capabilities = capabilities, flags = { debounce_text_changes = 150, }, - cmd = { "solargraph", "stdio" }, - filetypes = { 'ruby' }, - settings = { - solargraph = { - diagnostics = true, - }, - }, } -require 'lspconfig'.bashls.setup { +require 'lspconfig'.pylsp.setup { on_attach = on_attach, capabilities = capabilities, flags = { @@ -143,23 +109,23 @@ require 'lspconfig'.bashls.setup { }, } -require 'lspconfig'.pylsp.setup { +require 'lspconfig'.clangd.setup { on_attach = on_attach, capabilities = capabilities, flags = { debounce_text_changes = 150, }, + cmd = { "/usr/bin/clangd-13" }; } -require 'lspconfig'.clangd.setup { +require 'lspconfig'.solargraph.setup { on_attach = on_attach, capabilities = capabilities, flags = { debounce_text_changes = 150, - }, + } } - -- suppress error messages from lang servers vim.notify = function(msg, log_level, _) if msg:match 'exit code' then diff --git a/.config/nvim/plugin/packer_compiled.lua b/.config/nvim/plugin/packer_compiled.lua new file mode 100644 index 0000000..6275daa --- /dev/null +++ b/.config/nvim/plugin/packer_compiled.lua @@ -0,0 +1,299 @@ +-- Automatically generated packer.nvim plugin loader code + +if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then + vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"') + return +end + +vim.api.nvim_command('packadd packer.nvim') + +local no_errors, error_msg = pcall(function() + +_G._packer = _G._packer or {} +_G._packer.inside_compile = true + +local time +local profile_info +local should_profile = false +if should_profile then + local hrtime = vim.loop.hrtime + profile_info = {} + time = function(chunk, start) + if start then + profile_info[chunk] = hrtime() + else + profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6 + end + end +else + time = function(chunk, start) end +end + +local function save_profiles(threshold) + local sorted_times = {} + for chunk_name, time_taken in pairs(profile_info) do + sorted_times[#sorted_times + 1] = {chunk_name, time_taken} + end + table.sort(sorted_times, function(a, b) return a[2] > b[2] end) + local results = {} + for i, elem in ipairs(sorted_times) do + if not threshold or threshold and elem[2] > threshold then + results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms' + end + end + if threshold then + table.insert(results, '(Only showing plugins that took longer than ' .. threshold .. ' ms ' .. 'to load)') + end + + _G._packer.profile_output = results +end + +time([[Luarocks path setup]], true) +local package_path_str = "/home/cafebabe/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/cafebabe/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/cafebabe/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/cafebabe/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua" +local install_cpath_pattern = "/home/cafebabe/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so" +if not string.find(package.path, package_path_str, 1, true) then + package.path = package.path .. ';' .. package_path_str +end + +if not string.find(package.cpath, install_cpath_pattern, 1, true) then + package.cpath = package.cpath .. ';' .. install_cpath_pattern +end + +time([[Luarocks path setup]], false) +time([[try_loadstring definition]], true) +local function try_loadstring(s, component, name) + local success, result = pcall(loadstring(s), name, _G.packer_plugins[name]) + if not success then + vim.schedule(function() + vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {}) + end) + end + return result +end + +time([[try_loadstring definition]], false) +time([[Defining packer_plugins]], true) +_G.packer_plugins = { + LuaSnip = { + config = { "\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" }, + loaded = true, + path = "/home/cafebabe/.local/share/nvim/site/pack/packer/start/LuaSnip", + url = "https://github.com/L3MON4D3/LuaSnip" + }, + ["cmp-buffer"] = { + loaded = true, + path = "/home/cafebabe/.local/share/nvim/site/pack/packer/start/cmp-buffer", + url = "https://github.com/hrsh7th/cmp-buffer" + }, + ["cmp-nvim-lsp"] = { + loaded = true, + path = "/home/cafebabe/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp", + url = "https://github.com/hrsh7th/cmp-nvim-lsp" + }, + ["cmp-nvim-lsp-signature-help"] = { + loaded = true, + path = "/home/cafebabe/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp-signature-help", + url = "https://github.com/hrsh7th/cmp-nvim-lsp-signature-help" + }, + ["cmp-nvim-lua"] = { + loaded = true, + path = "/home/cafebabe/.local/share/nvim/site/pack/packer/start/cmp-nvim-lua", + url = "https://github.com/hrsh7th/cmp-nvim-lua" + }, + ["cmp-path"] = { + loaded = true, + path = "/home/cafebabe/.local/share/nvim/site/pack/packer/start/cmp-path", + url = "https://github.com/jessarcher/cmp-path" + }, + dracula = { + config = { "\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" }, + loaded = true, + path = "/home/cafebabe/.local/share/nvim/site/pack/packer/start/dracula", + url = "https://github.com/dracula/vim" + }, + ["lsp-colors.nvim"] = { + loaded = true, + path = "/home/cafebabe/.local/share/nvim/site/pack/packer/start/lsp-colors.nvim", + url = "https://github.com/folke/lsp-colors.nvim" + }, + ["lspkind-nvim"] = { + loaded = true, + path = "/home/cafebabe/.local/share/nvim/site/pack/packer/start/lspkind-nvim", + url = "https://github.com/onsails/lspkind-nvim" + }, + ["lualine.nvim"] = { + config = { "\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" }, + loaded = true, + path = "/home/cafebabe/.local/share/nvim/site/pack/packer/start/lualine.nvim", + url = "https://github.com/nvim-lualine/lualine.nvim" + }, + ["nvim-autopairs"] = { + config = { "\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" }, + loaded = true, + path = "/home/cafebabe/.local/share/nvim/site/pack/packer/start/nvim-autopairs", + url = "https://github.com/windwp/nvim-autopairs" + }, + ["nvim-cmp"] = { + config = { "\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" }, + loaded = true, + path = "/home/cafebabe/.local/share/nvim/site/pack/packer/start/nvim-cmp", + url = "https://github.com/hrsh7th/nvim-cmp" + }, + ["nvim-code-action-menu"] = { + loaded = true, + path = "/home/cafebabe/.local/share/nvim/site/pack/packer/start/nvim-code-action-menu", + url = "https://github.com/weilbith/nvim-code-action-menu" + }, + ["nvim-lspconfig"] = { + config = { "\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" }, + loaded = true, + path = "/home/cafebabe/.local/share/nvim/site/pack/packer/start/nvim-lspconfig", + url = "https://github.com/neovim/nvim-lspconfig" + }, + ["nvim-tree.lua"] = { + config = { "\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" }, + loaded = true, + path = "/home/cafebabe/.local/share/nvim/site/pack/packer/start/nvim-tree.lua", + url = "https://github.com/kyazdani42/nvim-tree.lua" + }, + ["nvim-treesitter"] = { + config = { "\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" }, + loaded = true, + path = "/home/cafebabe/.local/share/nvim/site/pack/packer/start/nvim-treesitter", + url = "https://github.com/nvim-treesitter/nvim-treesitter" + }, + ["nvim-treesitter-textobjects"] = { + loaded = true, + path = "/home/cafebabe/.local/share/nvim/site/pack/packer/start/nvim-treesitter-textobjects", + url = "https://github.com/nvim-treesitter/nvim-treesitter-textobjects" + }, + ["nvim-ts-autotag"] = { + config = { "\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" }, + loaded = true, + path = "/home/cafebabe/.local/share/nvim/site/pack/packer/start/nvim-ts-autotag", + url = "https://github.com/windwp/nvim-ts-autotag" + }, + ["nvim-ts-context-commentstring"] = { + loaded = true, + path = "/home/cafebabe/.local/share/nvim/site/pack/packer/start/nvim-ts-context-commentstring", + url = "https://github.com/JoosepAlviste/nvim-ts-context-commentstring" + }, + ["nvim-web-devicons"] = { + loaded = true, + path = "/home/cafebabe/.local/share/nvim/site/pack/packer/start/nvim-web-devicons", + url = "https://github.com/kyazdani42/nvim-web-devicons" + }, + ["packer.nvim"] = { + loaded = true, + path = "/home/cafebabe/.local/share/nvim/site/pack/packer/start/packer.nvim", + url = "https://github.com/wbthomason/packer.nvim" + }, + playground = { + loaded = true, + path = "/home/cafebabe/.local/share/nvim/site/pack/packer/start/playground", + url = "https://github.com/nvim-treesitter/playground" + }, + ["plenary.nvim"] = { + loaded = true, + path = "/home/cafebabe/.local/share/nvim/site/pack/packer/start/plenary.nvim", + url = "https://github.com/nvim-lua/plenary.nvim" + }, + ["popup.nvim"] = { + loaded = true, + path = "/home/cafebabe/.local/share/nvim/site/pack/packer/start/popup.nvim", + url = "https://github.com/nvim-lua/popup.nvim" + }, + ["schemastore.nvim"] = { + loaded = true, + path = "/home/cafebabe/.local/share/nvim/site/pack/packer/start/schemastore.nvim", + url = "https://github.com/b0o/schemastore.nvim" + }, + ["spellsitter.nvim"] = { + loaded = true, + path = "/home/cafebabe/.local/share/nvim/site/pack/packer/start/spellsitter.nvim", + url = "https://github.com/lewis6991/spellsitter.nvim" + }, + ["telescope.nvim"] = { + config = { "\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" }, + loaded = true, + path = "/home/cafebabe/.local/share/nvim/site/pack/packer/start/telescope.nvim", + url = "https://github.com/nvim-telescope/telescope.nvim" + }, + ["vim-commentary"] = { + loaded = true, + path = "/home/cafebabe/.local/share/nvim/site/pack/packer/start/vim-commentary", + url = "https://github.com/tpope/vim-commentary" + }, + ["vim-eunuch"] = { + loaded = true, + path = "/home/cafebabe/.local/share/nvim/site/pack/packer/start/vim-eunuch", + url = "https://github.com/tpope/vim-eunuch" + }, + ["vim-sleuth"] = { + loaded = true, + path = "/home/cafebabe/.local/share/nvim/site/pack/packer/start/vim-sleuth", + url = "https://github.com/tpope/vim-sleuth" + }, + ["vim-surround"] = { + loaded = true, + path = "/home/cafebabe/.local/share/nvim/site/pack/packer/start/vim-surround", + url = "https://github.com/tpope/vim-surround" + } +} + +time([[Defining packer_plugins]], 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-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-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-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: telescope.nvim +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: 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-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: 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-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: 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") +time([[Config for LuaSnip]], false) + +_G._packer.inside_compile = false +if _G._packer.needs_bufread == true then + vim.cmd("doautocmd BufRead") +end +_G._packer.needs_bufread = false + +if should_profile then save_profiles() end + +end) + +if not no_errors then + error_msg = error_msg:gsub('"', '\\"') + vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None') +end diff --git a/.config/nvim/snippets/html.lua b/.config/nvim/snippets/all.lua index b168aca..78c33db 100644 --- a/.config/nvim/snippets/html.lua +++ b/.config/nvim/snippets/all.lua @@ -1,18 +1,21 @@ return { parse('sktn', '<!DOCTYPE html>\ -<html lang="en">\ +<html lang="en-US">\ \ <head>\ + <title>Website Title</title>\ <meta charset="UTF-8">\ - <title></title>\ <meta name="viewport" content="width=devide-width,initial-scale=1">\ <link rel="stylesheet" href="">\ </head>\ \ <body>\ - <div>\ - <h1></h1>\ - </div>\ + <header>\ + <h1>Header Text</h1>\ + </header>\ + <main>\ + <p>Lorem ipsum bla, bla, bla...</p>\ + </main>\ </body>\ <script src=""></script>\ \ diff --git a/.config/picom/picom.conf b/.config/picom/picom.conf new file mode 100644 index 0000000..a095613 --- /dev/null +++ b/.config/picom/picom.conf @@ -0,0 +1,13 @@ +# just very slightly rounded corners +# empty file, just so transparency works on st + +opacity-rule = [ + "98:class_g = 'SchildiChat' && focused", + "98:class_g = 'SchildiChat' && !focused" +] + +# corner-radius = 6 + +# rounded-corners-exclude = [ +# "class_g = 'dwm'" +# ]; diff --git a/.config/pipewire/pipewire.conf b/.config/pipewire/pipewire.conf new file mode 100644 index 0000000..af1ff82 --- /dev/null +++ b/.config/pipewire/pipewire.conf @@ -0,0 +1,259 @@ +# Daemon config file for PipeWire version "0.3.63" # +# +# Copy and edit this file in /etc/pipewire for system-wide changes +# or in ~/.config/pipewire for local changes. +# +# It is also possible to place a file with an updated section in +# /etc/pipewire/pipewire.conf.d/ for system-wide changes or in +# ~/.config/pipewire/pipewire.conf.d/ for local changes. +# + +context.properties = { + ## Configure properties in the system. + #library.name.system = support/libspa-support + #context.data-loop.library.name.system = support/libspa-support + #support.dbus = true + #link.max-buffers = 64 + link.max-buffers = 16 # version < 3 clients can't handle more + #mem.warn-mlock = false + #mem.allow-mlock = true + #mem.mlock-all = false + #clock.power-of-two-quantum = true + #log.level = 2 + #cpu.zero.denormals = false + + core.daemon = true # listening for socket connections + core.name = pipewire-0 # core name and socket name + + ## Properties for the DSP configuration. + #default.clock.rate = 48000 + #default.clock.allowed-rates = [ 48000 ] + #default.clock.quantum = 1024 + default.clock.min-quantum = 16 + #default.clock.max-quantum = 2048 + #default.clock.quantum-limit = 8192 + #default.video.width = 640 + #default.video.height = 480 + #default.video.rate.num = 25 + #default.video.rate.denom = 1 + # + #settings.check-quantum = false + #settings.check-rate = false + # + # These overrides are only applied when running in a vm. + vm.overrides = { + default.clock.min-quantum = 1024 + } +} + +context.spa-libs = { + #<factory-name regex> = <library-name> + # + # Used to find spa factory names. It maps an spa factory name + # regular expression to a library name that should contain + # that factory. + # + audio.convert.* = audioconvert/libspa-audioconvert + avb.* = avb/libspa-avb + api.alsa.* = alsa/libspa-alsa + api.v4l2.* = v4l2/libspa-v4l2 + api.libcamera.* = libcamera/libspa-libcamera + api.bluez5.* = bluez5/libspa-bluez5 + api.vulkan.* = vulkan/libspa-vulkan + api.jack.* = jack/libspa-jack + support.* = support/libspa-support + #videotestsrc = videotestsrc/libspa-videotestsrc + #audiotestsrc = audiotestsrc/libspa-audiotestsrc +} + +context.modules = [ + #{ name = <module-name> + # [ args = { <key> = <value> ... } ] + # [ flags = [ [ ifexists ] [ nofail ] ] + #} + # + # Loads a module with the given parameters. + # If ifexists is given, the module is ignored when it is not found. + # If nofail is given, module initialization failures are ignored. + # + + # Uses realtime scheduling to boost the audio thread priorities. This uses + # RTKit if the user doesn't have permission to use regular realtime + # scheduling. + { name = libpipewire-module-rt + args = { + nice.level = -11 + #rt.prio = 88 + #rt.time.soft = -1 + #rt.time.hard = -1 + } + flags = [ ifexists nofail ] + } + + # The native communication protocol. + { name = libpipewire-module-protocol-native } + + # The profile module. Allows application to access profiler + # and performance data. It provides an interface that is used + # by pw-top and pw-profiler. + { name = libpipewire-module-profiler } + + # Allows applications to create metadata objects. It creates + # a factory for Metadata objects. + { name = libpipewire-module-metadata } + + # Creates a factory for making devices that run in the + # context of the PipeWire server. + { name = libpipewire-module-spa-device-factory } + + # Creates a factory for making nodes that run in the + # context of the PipeWire server. + { name = libpipewire-module-spa-node-factory } + + # Allows creating nodes that run in the context of the + # client. Is used by all clients that want to provide + # data to PipeWire. + { name = libpipewire-module-client-node } + + # Allows creating devices that run in the context of the + # client. Is used by the session manager. + { name = libpipewire-module-client-device } + + # The portal module monitors the PID of the portal process + # and tags connections with the same PID as portal + # connections. + { name = libpipewire-module-portal + flags = [ ifexists nofail ] + } + + # The access module can perform access checks and block + # new clients. + { name = libpipewire-module-access + args = { + # access.allowed to list an array of paths of allowed + # apps. + #access.allowed = [ + # /usr/bin/pipewire-media-session + #] + + # An array of rejected paths. + #access.rejected = [ ] + + # An array of paths with restricted access. + #access.restricted = [ ] + + # Anything not in the above lists gets assigned the + # access.force permission. + #access.force = flatpak + } + } + + # Makes a factory for wrapping nodes in an adapter with a + # converter and resampler. + { name = libpipewire-module-adapter } + + # Makes a factory for creating links between ports. + { name = libpipewire-module-link-factory } + + # Provides factories to make session manager objects. + { name = libpipewire-module-session-manager } + + # Use libcanberra to play X11 Bell + { name = libpipewire-module-x11-bell + args = { + #sink.name = "" + #sample.name = "bell-window-system" + #x11.display = null + #x11.xauthority = null + } + flags = [ ifexists nofail ] + } +] + +context.objects = [ + #{ factory = <factory-name> + # [ args = { <key> = <value> ... } ] + # [ flags = [ [ nofail ] ] + #} + # + # Creates an object from a PipeWire factory with the given parameters. + # If nofail is given, errors are ignored (and no object is created). + # + #{ factory = spa-node-factory args = { factory.name = videotestsrc node.name = videotestsrc Spa:Pod:Object:Param:Props:patternType = 1 } } + #{ factory = spa-device-factory args = { factory.name = api.jack.device foo=bar } flags = [ nofail ] } + #{ factory = spa-device-factory args = { factory.name = api.alsa.enum.udev } } + #{ factory = spa-node-factory args = { factory.name = api.alsa.seq.bridge node.name = Internal-MIDI-Bridge } } + #{ factory = adapter args = { factory.name = audiotestsrc node.name = my-test } } + #{ factory = spa-node-factory args = { factory.name = api.vulkan.compute.source node.name = my-compute-source } } + + # A default dummy driver. This handles nodes marked with the "node.always-driver" + # property when no other driver is currently active. JACK clients need this. + { factory = spa-node-factory + args = { + factory.name = support.node.driver + node.name = Dummy-Driver + node.group = pipewire.dummy + priority.driver = 20000 + } + } + { factory = spa-node-factory + args = { + factory.name = support.node.driver + node.name = Freewheel-Driver + priority.driver = 19000 + node.group = pipewire.freewheel + node.freewheel = true + } + } + # This creates a new Source node. It will have input ports + # that you can link, to provide audio for this source. + #{ factory = adapter + # args = { + # factory.name = support.null-audio-sink + # node.name = "my-mic" + # node.description = "Microphone" + # media.class = "Audio/Source/Virtual" + # audio.position = "FL,FR" + # } + #} + + # This creates a single PCM source device for the given + # alsa device path hw:0. You can change source to sink + # to make a sink in the same way. + #{ factory = adapter + # args = { + # factory.name = api.alsa.pcm.source + # node.name = "alsa-source" + # node.description = "PCM Source" + # media.class = "Audio/Source" + # api.alsa.path = "hw:0" + # api.alsa.period-size = 1024 + # api.alsa.headroom = 0 + # api.alsa.disable-mmap = false + # api.alsa.disable-batch = false + # audio.format = "S16LE" + # audio.rate = 48000 + # audio.channels = 2 + # audio.position = "FL,FR" + # } + #} +] + +context.exec = [ + #{ path = <program-name> [ args = "<arguments>" ] } + # + # Execute the given program with arguments. + # + # You can optionally start the session manager here, + # but it is better to start it as a systemd service. + # Run the session manager with -h for options. + # + { path = "/usr/bin/wireplumber" args = "" } + # + # You can optionally start the pulseaudio-server here as well + # but it is better to start it as a systemd service. + # It can be interesting to start another daemon here that listens + # on another address with the -a option (eg. -a tcp:4713). + # + { path = "/usr/bin/pipewire" args = "-c pipewire-pulse.conf" } +] diff --git a/.config/shell/aliasrc b/.config/shell/aliasrc new file mode 100644 index 0000000..5d21bf7 --- /dev/null +++ b/.config/shell/aliasrc @@ -0,0 +1,130 @@ +## MISCELLANEOUS + +# various shortcuts +alias reboot='sudo reboot' +alias poweroff='sudo poweroff' +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 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' +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' + +# 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' + +# 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)" +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' + +# 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 +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; +} + +## CONVERTING VIDEO + +# convert video files to webm +mkwebm() { + ffmpeg -i "${1}" -c:v libvpx-vp9 -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' diff --git a/.config/shell/profile b/.config/shell/profile new file mode 100644 index 0000000..0093eed --- /dev/null +++ b/.config/shell/profile @@ -0,0 +1,30 @@ +umask 0077 + +export _JAVA_AWT_WM_NONREPARENTING=1 +export EDITOR="nvim" +export TERMINAL="st" +export BROWSER="firefox" + +export XDG_CONFIG_HOME="$HOME/.config" +export XDG_DATA_HOME="$HOME/.local/share" +export XDG_CACHE_HOME="$HOME/.cache" + +export XINITRC="$XDG_CONFIG_HOME/x11/xinitrc" +export ZDOTDIR="$XDG_CONFIG_HOME/zsh" + +export LC_ALL=en_US.UTF-8 + +export MAIL=~/.mutt/Maildir +export NO_AT_BRIDGE=1 + +export GTK_IM_MODULE='ibus' +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:$HOME/.rvm/bin" + + + diff --git a/.config/starship/starship.toml b/.config/starship/starship.toml deleted file mode 100644 index 63ba159..0000000 --- a/.config/starship/starship.toml +++ /dev/null @@ -1,48 +0,0 @@ -format = """ -[](#CA5FCA)\ -$username\ -[](fg:#CA5FCA bg:#A92BA9 )\ -$directory\ -[](fg:#A92BA9 bg:#DC317D)\ -$git_branch\ -$git_status\ -[ ](fg:#DC317D)\ -""" - -# Disable the blank line at the start of the prompt -# add_newline = false - -# You can also replace your username with a neat symbol like to save some space -[username] -show_always = true -style_user = "fg:#FFFFFF bg:#CA5FCA" -style_root = "bg:#9A348E" -format = '[$user ]($style)' - -[directory] -style = "fg:#FFFFFF bg:#A92BA9" -format = "[ $path ]($style)" -truncation_length = 3 -truncation_symbol = "…/" - -# Here is how you can shorten some long paths by text replacement -# similar to mapped_locations in Oh My Posh: -[directory.substitutions] -"Documents" = " " -"Downloads" = " " -"Music" = " " -"Pictures" = " " -# Keep in mind that the order matters. For example: -# "Important Documents" = " " -# will not be replaced, because "Documents" was already substituted before. -# So either put "Important Documents" before "Documents" or use the substituted version: -# "Important " = " " - -[git_branch] -symbol = "" -style = "fg:#FFFFFF bg:#DC317D" -format = '[ $symbol $branch ]($style)' - -[git_status] -style = "fg:#FFFFFF bg:#DC317D" -format = '[$all_status$ahead_behind ]($style)' diff --git a/.config/sxiv/exec/key-handler b/.config/sxiv/exec/key-handler index 5ca4443..981eb8e 100755 --- a/.config/sxiv/exec/key-handler +++ b/.config/sxiv/exec/key-handler @@ -1,10 +1,11 @@ #!/usr/bin/env bash -while read file +while read -r file do case "$1" in - "C-d") trash-put "$file" ;; + "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/tmux/tmux.conf b/.config/tmux/tmux.conf new file mode 100644 index 0000000..1db3b54 --- /dev/null +++ b/.config/tmux/tmux.conf @@ -0,0 +1,41 @@ +# Status-bar settings +set -g status-right "%H:%M" +set -g window-status-current-style "underscore" +set -g message-command-style 'fg=#000000,bg=#FFFF00' +set -g message-style 'fg=#000000, bg=#FFFF00' +set -g status-bg '#333333' +set -g status-fg '#FFFFFF' +set -g set-titles on +set -g set-titles-string "#T" + +# Enable RGB colour if running in xterm(1) +set-option -sa terminal-overrides ",xterm*:Tc" + +# Change the default $TERM to tmux-256color +set -g default-terminal "tmux-256color" + +# Set history-limit +set -g history-limit 30000 + +## KEYBINDS + +# Change the prefix key to C-a +set -g prefix C-a +unbind C-b +bind C-a send-prefix + +bind C-v split-window -v # split vertically +bind C-h split-window -h # split horizontally +bind C-w killp # kill pane +bind C-q killw # kill window +bind -n M-h select-pane -L +bind -n M-l select-pane -R +bind -n M-k select-pane -U +bind -n M-j select-pane -D + +# Turn the mouse on, but without copy mode dragging +set -g mouse off + +# Keys to toggle monitoring activity in a window and the synchronize-panes option +bind m set monitor-activity +bind y set synchronize-panes\; display 'synchronize-panes #{?synchronize-panes,on,off}' diff --git a/.config/wireplumber/main.lua.d/51-camera-microphone-input-rename.lua b/.config/wireplumber/main.lua.d/51-camera-microphone-input-rename.lua new file mode 100644 index 0000000..c7db70e --- /dev/null +++ b/.config/wireplumber/main.lua.d/51-camera-microphone-input-rename.lua @@ -0,0 +1,13 @@ +rule = { + matches = { + { + { "node.name", "equals", "alsa_input.usb-SunplusIT_Inc_FHD_Camera_Microphone_01.00.00-02.analog-stereo"}, + }, + }, + apply_properties = { + ["node.description"] = "Camera Microphone", + ["node.nick"] = "Camera Microphone", + }, +} + +table.insert(alsa_monitor.rules,rule) diff --git a/.config/wireplumber/main.lua.d/51-soundblaster-output-rename.lua b/.config/wireplumber/main.lua.d/51-soundblaster-output-rename.lua new file mode 100644 index 0000000..cb5d4a3 --- /dev/null +++ b/.config/wireplumber/main.lua.d/51-soundblaster-output-rename.lua @@ -0,0 +1,14 @@ +rule = { + matches = { + { + { "node.name", "equals", "alsa_output.pci-0000_29_00.0.analog-stereo"}, + }, + }, + + apply_properties = { + ["node.description"] = "Headphones", + ["node.nick"] = "Headphones", + }, +} + +table.insert(alsa_monitor.rules,rule) diff --git a/.config/wireplumber/main.lua.d/51-starshipmatisse-output-rename.lua b/.config/wireplumber/main.lua.d/51-starshipmatisse-output-rename.lua new file mode 100644 index 0000000..0a3c278 --- /dev/null +++ b/.config/wireplumber/main.lua.d/51-starshipmatisse-output-rename.lua @@ -0,0 +1,14 @@ +rule = { + matches = { + { + { "node.name", "equals", "alsa_output.pci-0000_31_00.4.analog-stereo"}, + }, + }, + + apply_properties = { + ["node.description"] = "Speakers", + ["node.nick"] = "Speakers", + }, +} + +table.insert(alsa_monitor.rules,rule) diff --git a/.config/wireplumber/main.lua.d/52-hdmi-card-disable.lua b/.config/wireplumber/main.lua.d/52-hdmi-card-disable.lua new file mode 100644 index 0000000..63eb9e4 --- /dev/null +++ b/.config/wireplumber/main.lua.d/52-hdmi-card-disable.lua @@ -0,0 +1,12 @@ +rule = { + matches = { + { + { "device.name", "equals", "alsa_card.pci-0000_2f_00.1"}, + }, + }, + apply_properties = { + ["device.disabled"] = true, + }, +} + +table.insert(alsa_monitor.rules,rule) diff --git a/.config/wireplumber/main.lua.d/52-soundblaster-input-disable.lua b/.config/wireplumber/main.lua.d/52-soundblaster-input-disable.lua new file mode 100644 index 0000000..825c7d9 --- /dev/null +++ b/.config/wireplumber/main.lua.d/52-soundblaster-input-disable.lua @@ -0,0 +1,12 @@ +rule = { + matches = { + { + { "node.name", "equals", "alsa_input.pci-0000_29_00.0.analog-stereo"}, + }, + }, + apply_properties = { + ["node.disabled"] = true, + }, +} + +table.insert(alsa_monitor.rules,rule) diff --git a/.config/wireplumber/main.lua.d/52-starshipmatisse-input-disable.lua b/.config/wireplumber/main.lua.d/52-starshipmatisse-input-disable.lua new file mode 100644 index 0000000..51edd83 --- /dev/null +++ b/.config/wireplumber/main.lua.d/52-starshipmatisse-input-disable.lua @@ -0,0 +1,12 @@ +rule = { + matches = { + { + { "node.name", "equals", "alsa_input.pci-0000_31_00.4.analog-stereo"}, + }, + }, + apply_properties = { + ["node.disabled"] = true, + }, +} + +table.insert(alsa_monitor.rules,rule) diff --git a/.config/x11/xinitrc b/.config/x11/xinitrc new file mode 100644 index 0000000..76a3ff5 --- /dev/null +++ b/.config/x11/xinitrc @@ -0,0 +1,31 @@ +#!/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 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 + +ibus-daemon -dxrR +/usr/local/bin/emacs --daemon & +statusbar & +pipewire & +mpd & +picom & +set-wallpaper & + +exec dwm + diff --git a/.config/zathura/zathurarc b/.config/zathura/zathurarc new file mode 100644 index 0000000..452e116 --- /dev/null +++ b/.config/zathura/zathurarc @@ -0,0 +1,15 @@ +set sandbox none +set statusbar-h-padding 0 +set statusbar-v-padding 0 +set page-padding 1 +set selection-clipboard clipboard +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 +map g goto top diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc new file mode 100644 index 0000000..e94a036 --- /dev/null +++ b/.config/zsh/.zshrc @@ -0,0 +1,114 @@ +autoload -U colors && colors + +stty stop undef +setopt no_nomatch + +autoload -U compinit +zstyle ':completion:*' menu select +zmodload zsh/complist +compinit +_comp_options+=(globdots) + +# vi mode +setopt PROMPT_SUBST + +THEME_VI_INS_MODE_SYMBOL=${THEME_VI_INS_MODE_SYMBOL:-'λ'} +THEME_VI_CMD_MODE_SYMBOL=${THEME_VI_CMD_MODE_SYMBOL:-'ᐅ'} + +THEME_VI_MODE_SYMBOL="${THEME_VI_INS_MODE_SYMBOL}" + +bindkey -v +export KEYTIMEOUT=1 + +# Use vim keys in tab complete menu: +bindkey -M menuselect 'h' vi-backward-char +bindkey -M menuselect 'k' vi-up-line-or-history +bindkey -M menuselect 'l' vi-forward-char +bindkey -M menuselect 'j' vi-down-line-or-history +bindkey -v '^?' backward-delete-char + +bindkey '^a' vi-beginning-of-line +bindkey '^e' vi-end-of-line + +zle-keymap-select() { + if [ "${KEYMAP}" = 'vicmd' ]; then + THEME_VI_MODE_SYMBOL="${THEME_VI_CMD_MODE_SYMBOL}" + else + THEME_VI_MODE_SYMBOL="${THEME_VI_INS_MODE_SYMBOL}" + fi + zle reset-prompt +} +zle -N zle-keymap-select + +# reset to default mode at the end of line input reading +zle-line-finish() { + THEME_VI_MODE_SYMBOL="${THEME_VI_INS_MODE_SYMBOL}" +} +zle -N zle-line-finish + +# Fix a bug when you C-c in CMD mode, you'd be prompted with CMD mode indicator +# while in fact you would be in INS mode. +# Fixed by catching SIGINT (C-c), set mode to INS and repropagate the SIGINT, +# so if anything else depends on it, we will not break it. +TRAPINT() { + THEME_VI_MODE_SYMBOL="${THEME_VI_INS_MODE_SYMBOL}" + return $(( 128 + $1 )) +} + +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 + +HISTFILE=$ZDOTDIR/.zsh_history +HISTSIZE='2000' +SAVEHIST='1000' + +# ignore duplicate in history +setopt hist_expire_dups_first +setopt hist_ignore_dups +setopt hist_ignore_all_dups +setopt hist_find_no_dups +setopt hist_save_no_dups + +DIRSTACKSIZE='20' + +setopt auto_pushd +setopt pushd_silent +setopt pushd_ignore_dups +setopt pushd_minus + + +[ -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)" +fi + +if [ -f $XDG_CONFIG_HOME/shell/aliasrc ]; then + . $XDG_CONFIG_HOME/shell/aliasrc +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 + +# Add RVM to PATH for scripting. Make sure this is the last PATH variable change. +[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* + +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 + diff --git a/.ncmpcpp/bindings b/.ncmpcpp/bindings index b7057ff..6962dea 100644 --- a/.ncmpcpp/bindings +++ b/.ncmpcpp/bindings @@ -178,12 +178,12 @@ def_key "j" #def_key "}" # scroll_down_artist # -#def_key "page_up" -# page_up -# -#def_key "page_down" -# page_down -# +def_key "u" + page_up + +def_key "d" + page_down + #def_key "home" # move_home # @@ -367,9 +367,9 @@ def_key "j" #def_key "X" # set_crossfade # -#def_key "u" -# update_database -# +def_key "U" + update_database + #def_key "ctrl-s" # sort_playlist # 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 @@ -1,36 +1 @@ -#!/bin/sh - -if [ -d /etc/X11/xinit/xinitrc.d ]; then - for f in /etc/X11/xinit/xinitrc.d/*; do - [ -x "$f" ] && . "$f" - done - unset f -fi - -if [ -f $HOME/.local/bin/statusbar ]; then - . $HOME/.local/bin/statusbar -fi - -# exec ck-launch-session dbus-launch --exit-with-session /usr/local/bin/dwm - -# export GTK_IM_MODULE='ibus' -# export QT_IM_MODULE='ibus' -# export XMODIFIERS='@im=ibus' - -rfkill block all - -# ibus-daemon -dxrR - -xrandr --auto --output HDMI-A-0 --mode 1920x1080 --primary -xrandr --auto --output DisplayPort-2 --mode 1600x900 --left-of HDMI-A-0 - -xset s off -dpms - -setxkbmap -option "ctrl:nocaps" - -xwallpaper --maximize "$(/usr/bin/ls -d -1 /hdd/pics/wallpaper/* | shuf -n1)" & - -picom --config $HOME/.config/picom/picom.conf -b - -exec dwm - +.config/x11/xinitrc
\ No newline at end of file diff --git a/.zprofile b/.zprofile new file mode 120000 index 0000000..8486fca --- /dev/null +++ b/.zprofile @@ -0,0 +1 @@ +.config/shell/profile
\ No newline at end of file |
