Updates
This commit is contained in:
@@ -3,6 +3,7 @@ profile=gpu-hq
|
|||||||
#gpu-context=waylandvk
|
#gpu-context=waylandvk
|
||||||
gpu-context=wayland
|
gpu-context=wayland
|
||||||
hwdec=none
|
hwdec=none
|
||||||
|
hdr-compute-peak=no
|
||||||
|
|
||||||
#ao=jack
|
#ao=jack
|
||||||
#audio-channels=stereo
|
#audio-channels=stereo
|
||||||
@@ -27,10 +28,12 @@ screenshot-format=png
|
|||||||
sub-gray=yes # pour pas avoir des subs jaunes de merde
|
sub-gray=yes # pour pas avoir des subs jaunes de merde
|
||||||
sub-gauss=0.7 # ça rend les subs un peu moins carrés, peut-être à adapter à vos envies
|
sub-gauss=0.7 # ça rend les subs un peu moins carrés, peut-être à adapter à vos envies
|
||||||
sub-font="Roboto Regular"
|
sub-font="Roboto Regular"
|
||||||
|
#sub-ass-vsfilter-aspect-compat=no
|
||||||
|
#sub-ass-vsfilter-blur-compat=no
|
||||||
|
|
||||||
prefetch-playlist=yes
|
prefetch-playlist=yes
|
||||||
rebase-start-time=no
|
rebase-start-time=no
|
||||||
ytdl-format=bestvideo[height<=?1080]+bestaudio/best
|
ytdl-format=bestvideo[height<=?1440]+bestaudio/best
|
||||||
#ytdl-raw-options="rm-cache-dir=:yes-playlist="
|
#ytdl-raw-options="rm-cache-dir=:yes-playlist="
|
||||||
|
|
||||||
osd-fractions=yes
|
osd-fractions=yes
|
||||||
@@ -39,4 +42,4 @@ osd-fractions=yes
|
|||||||
profile-desc="downmixing profile"
|
profile-desc="downmixing profile"
|
||||||
profile-cond=p["audio-params/channel-count"] > 2
|
profile-cond=p["audio-params/channel-count"] > 2
|
||||||
ad-lavc-downmix=no
|
ad-lavc-downmix=no
|
||||||
af=lavfi="pan=stereo|FL=0.5*FC+0.707*FL+0.707*BL+0.5*LFE|FR=0.5*FC+0.707*FR+0.707*BR+0.5*LFE"
|
af=lavfi="pan=stereo|FL=0.707*FC+0.5*FL+0.5*BL+0.1*LFE|FR=0.707*FC+0.5*FR+0.5*BR+0.1*LFE"
|
||||||
|
|||||||
1
.config/mpv/script-opts/autocrop.conf
Normal file
1
.config/mpv/script-opts/autocrop.conf
Normal file
@@ -0,0 +1 @@
|
|||||||
|
auto=no
|
||||||
29
.config/mpv/script-opts/thumbfast.conf
Normal file
29
.config/mpv/script-opts/thumbfast.conf
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
# Socket path (leave empty for auto)
|
||||||
|
socket=
|
||||||
|
|
||||||
|
# Thumbnail path (leave empty for auto)
|
||||||
|
thumbnail=
|
||||||
|
|
||||||
|
# Maximum thumbnail size in pixels (scaled down to fit)
|
||||||
|
# Values are scaled when hidpi is enabled
|
||||||
|
max_height=200
|
||||||
|
max_width=200
|
||||||
|
|
||||||
|
# Overlay id
|
||||||
|
overlay_id=42
|
||||||
|
|
||||||
|
# Thumbnail interval in seconds set to 0 to disable (warning: high cpu usage)
|
||||||
|
interval=6
|
||||||
|
|
||||||
|
# Number of thumbnails
|
||||||
|
min_thumbnails=6
|
||||||
|
max_thumbnails=120
|
||||||
|
|
||||||
|
# Spawn thumbnailer on file load for faster initial thumbnails
|
||||||
|
spawn_first=no
|
||||||
|
|
||||||
|
# Enable on network playback
|
||||||
|
network=yes
|
||||||
|
|
||||||
|
# Enable on audio playback
|
||||||
|
audio=no
|
||||||
329
.config/mpv/scripts/autocrop.lua
Normal file
329
.config/mpv/scripts/autocrop.lua
Normal file
@@ -0,0 +1,329 @@
|
|||||||
|
--[[
|
||||||
|
This script uses the lavfi cropdetect filter to automatically
|
||||||
|
insert a crop filter with appropriate parameters for the
|
||||||
|
currently playing video.
|
||||||
|
|
||||||
|
It will automatically crop the video, when playback starts.
|
||||||
|
|
||||||
|
Also It registers the key-binding "C" (shift+c). You can manually
|
||||||
|
crop the video by pressing the "C" (shift+c) key.
|
||||||
|
|
||||||
|
If the "C" key is pressed again, the crop filter is removed
|
||||||
|
restoring playback to its original state.
|
||||||
|
|
||||||
|
The workflow is as follows: First, it inserts the filter
|
||||||
|
vf=lavfi=cropdetect. After <detect_seconds> (default is 1)
|
||||||
|
seconds, it then inserts the filter vf=crop=w:h:x:y, where
|
||||||
|
w,h,x,y are determined from the vf-metadata gathered by
|
||||||
|
cropdetect. The cropdetect filter is removed immediately after
|
||||||
|
the crop filter is inserted as it is no longer needed.
|
||||||
|
|
||||||
|
Since the crop parameters are determined from the 1 second of
|
||||||
|
video between inserting the cropdetect and crop filters, the "C"
|
||||||
|
key should be pressed at a position in the video where the crop
|
||||||
|
region is unambiguous (i.e., not a black frame, black background
|
||||||
|
title card, or dark scene).
|
||||||
|
|
||||||
|
The default options can be overridden by adding
|
||||||
|
script-opts-append=autocrop-<parameter>=<value> into mpv.conf
|
||||||
|
|
||||||
|
List of available parameters (For default values, see <options>):
|
||||||
|
|
||||||
|
auto: bool - Whether to automatically apply crop at the start of
|
||||||
|
playback. If you don't want to crop automatically, set it to
|
||||||
|
false or add "script-opts-append=autocrop-auto=no" into
|
||||||
|
mpv.conf.
|
||||||
|
|
||||||
|
auto_delay: seconds - Delay before starting crop in auto mode.
|
||||||
|
You can try to increase this value to avoid dark scene or
|
||||||
|
fade in at beginning. Automatic cropping will not occur if
|
||||||
|
the value is larger than the remaining playback time.
|
||||||
|
|
||||||
|
detect_limit: number[0-255] - Black threshold for cropdetect.
|
||||||
|
Smaller values will generally result in less cropping.
|
||||||
|
See limit of https://ffmpeg.org/ffmpeg-filters.html#cropdetect
|
||||||
|
|
||||||
|
detect_round: number[2^n] - The value which the width/height
|
||||||
|
should be divisible by. Smaller values have better detection
|
||||||
|
accuracy. If you have problems with other filters,
|
||||||
|
you can try to set it to 4 or 16.
|
||||||
|
See round of https://ffmpeg.org/ffmpeg-filters.html#cropdetect
|
||||||
|
|
||||||
|
detect_min_ratio: number[0.0-1.0] - The ratio of the minimum clip
|
||||||
|
size to the original. If the picture is over cropped or under
|
||||||
|
cropped, try adjusting this value.
|
||||||
|
|
||||||
|
detect_seconds: seconds - How long to gather cropdetect data.
|
||||||
|
Increasing this may be desirable to allow cropdetect more
|
||||||
|
time to collect data.
|
||||||
|
|
||||||
|
suppress_osd: bool - Whether the OSD shouldn't be used when filters
|
||||||
|
are applied and removed.
|
||||||
|
--]]
|
||||||
|
|
||||||
|
require "mp.msg"
|
||||||
|
require 'mp.options'
|
||||||
|
|
||||||
|
local options = {
|
||||||
|
auto = true,
|
||||||
|
auto_delay = 4,
|
||||||
|
detect_limit = "24/255",
|
||||||
|
detect_round = 2,
|
||||||
|
detect_min_ratio = 0.5,
|
||||||
|
detect_seconds = 1,
|
||||||
|
suppress_osd = false,
|
||||||
|
}
|
||||||
|
read_options(options)
|
||||||
|
|
||||||
|
local label_prefix = mp.get_script_name()
|
||||||
|
local labels = {
|
||||||
|
crop = string.format("%s-crop", label_prefix),
|
||||||
|
cropdetect = string.format("%s-cropdetect", label_prefix)
|
||||||
|
}
|
||||||
|
|
||||||
|
timers = {
|
||||||
|
auto_delay = nil,
|
||||||
|
detect_crop = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
local command_prefix = options.suppress_osd and 'no-osd' or ''
|
||||||
|
|
||||||
|
function is_filter_present(label)
|
||||||
|
local filters = mp.get_property_native("vf")
|
||||||
|
for index, filter in pairs(filters) do
|
||||||
|
if filter["label"] == label then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
function is_enough_time(seconds)
|
||||||
|
|
||||||
|
-- Plus 1 second for deviation.
|
||||||
|
local time_needed = seconds + 1
|
||||||
|
local playtime_remaining = mp.get_property_native("playtime-remaining")
|
||||||
|
|
||||||
|
return playtime_remaining and time_needed < playtime_remaining
|
||||||
|
end
|
||||||
|
|
||||||
|
function is_cropable()
|
||||||
|
for _, track in pairs(mp.get_property_native('track-list')) do
|
||||||
|
if track.type == 'video' and track.selected then
|
||||||
|
return not track.albumart
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
function remove_filter(label)
|
||||||
|
if is_filter_present(label) then
|
||||||
|
mp.command(string.format('%s vf remove @%s', command_prefix, label))
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
function cleanup()
|
||||||
|
|
||||||
|
-- Remove all existing filters.
|
||||||
|
for key, value in pairs(labels) do
|
||||||
|
remove_filter(value)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Kill all timers.
|
||||||
|
for index, timer in pairs(timers) do
|
||||||
|
if timer then
|
||||||
|
timer:kill()
|
||||||
|
timer = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function detect_crop()
|
||||||
|
|
||||||
|
-- If it's not cropable, exit.
|
||||||
|
if not is_cropable() then
|
||||||
|
mp.msg.warn("autocrop only works for videos.")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Verify if there is enough time to detect crop.
|
||||||
|
local time_needed = options.detect_seconds
|
||||||
|
|
||||||
|
if not is_enough_time(time_needed) then
|
||||||
|
mp.msg.warn("Not enough time to detect crop.")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Insert the cropdetect filter.
|
||||||
|
local limit = options.detect_limit
|
||||||
|
local round = options.detect_round
|
||||||
|
|
||||||
|
mp.command(
|
||||||
|
string.format(
|
||||||
|
'%s vf pre @%s:cropdetect=limit=%s:round=%d:reset=0',
|
||||||
|
command_prefix, labels.cropdetect, limit, round
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
-- Wait to gather data.
|
||||||
|
timers.detect_crop = mp.add_timeout(time_needed, detect_end)
|
||||||
|
end
|
||||||
|
|
||||||
|
function detect_end()
|
||||||
|
|
||||||
|
-- Get the metadata and remove the cropdetect filter.
|
||||||
|
local cropdetect_metadata =
|
||||||
|
mp.get_property_native(
|
||||||
|
string.format("vf-metadata/%s",
|
||||||
|
labels.cropdetect
|
||||||
|
)
|
||||||
|
)
|
||||||
|
remove_filter(labels.cropdetect)
|
||||||
|
|
||||||
|
-- Remove the timer of detect crop.
|
||||||
|
if timers.detect_crop then
|
||||||
|
timers.detect_crop:kill()
|
||||||
|
timers.detect_crop = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
local meta = {}
|
||||||
|
|
||||||
|
-- Verify the existence of metadata.
|
||||||
|
if cropdetect_metadata then
|
||||||
|
meta = {
|
||||||
|
w = cropdetect_metadata["lavfi.cropdetect.w"],
|
||||||
|
h = cropdetect_metadata["lavfi.cropdetect.h"],
|
||||||
|
x = cropdetect_metadata["lavfi.cropdetect.x"],
|
||||||
|
y = cropdetect_metadata["lavfi.cropdetect.y"],
|
||||||
|
}
|
||||||
|
else
|
||||||
|
mp.msg.error("No crop data.")
|
||||||
|
mp.msg.info("Was the cropdetect filter successfully inserted?")
|
||||||
|
mp.msg.info("Does your version of ffmpeg/libav support AVFrame metadata?")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Verify that the metadata meets the requirements and convert it.
|
||||||
|
if meta.w and meta.h and meta.x and meta.y then
|
||||||
|
local width = mp.get_property_native("width")
|
||||||
|
local height = mp.get_property_native("height")
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
w = tonumber(meta.w),
|
||||||
|
h = tonumber(meta.h),
|
||||||
|
x = tonumber(meta.x),
|
||||||
|
y = tonumber(meta.y),
|
||||||
|
min_w = width * options.detect_min_ratio,
|
||||||
|
min_h = height * options.detect_min_ratio,
|
||||||
|
max_w = width,
|
||||||
|
max_h = height
|
||||||
|
}
|
||||||
|
else
|
||||||
|
mp.msg.error("Got empty crop data.")
|
||||||
|
mp.msg.info("You might need to increase detect_seconds.")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
apply_crop(meta)
|
||||||
|
end
|
||||||
|
|
||||||
|
function apply_crop(meta)
|
||||||
|
|
||||||
|
-- Verify if it is necessary to crop.
|
||||||
|
local is_effective = meta.x > 0 or meta.y > 0
|
||||||
|
or meta.w < meta.max_w or meta.h < meta.max_h
|
||||||
|
|
||||||
|
if not is_effective then
|
||||||
|
mp.msg.info("No area detected for cropping.")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Verify it is not over cropped.
|
||||||
|
local is_excessive = meta.w < meta.min_w and meta.h < meta.min_h
|
||||||
|
|
||||||
|
if is_excessive then
|
||||||
|
mp.msg.info("The area to be cropped is too large.")
|
||||||
|
mp.msg.info("You might need to decrease detect_min_ratio.")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Remove existing crop.
|
||||||
|
remove_filter(labels.crop)
|
||||||
|
|
||||||
|
-- Apply crop.
|
||||||
|
mp.command(
|
||||||
|
string.format("%s vf pre @%s:lavfi-crop=w=%s:h=%s:x=%s:y=%s",
|
||||||
|
command_prefix, labels.crop, meta.w, meta.h, meta.x, meta.y
|
||||||
|
)
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
function on_start()
|
||||||
|
|
||||||
|
-- Clean up at the beginning.
|
||||||
|
cleanup()
|
||||||
|
|
||||||
|
-- If auto is not true, exit.
|
||||||
|
if not options.auto then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- If it is the beginning, wait for detect_crop
|
||||||
|
-- after auto_delay seconds, otherwise immediately.
|
||||||
|
local playback_time = mp.get_property_native("playback-time")
|
||||||
|
local is_delay_needed = playback_time
|
||||||
|
and options.auto_delay > playback_time
|
||||||
|
|
||||||
|
if is_delay_needed then
|
||||||
|
|
||||||
|
-- Verify if there is enough time for autocrop.
|
||||||
|
local time_needed = options.auto_delay + options.detect_seconds
|
||||||
|
|
||||||
|
if not is_enough_time(time_needed) then
|
||||||
|
mp.msg.warn("Not enough time for autocrop.")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
timers.auto_delay = mp.add_timeout(time_needed,
|
||||||
|
function()
|
||||||
|
detect_crop()
|
||||||
|
|
||||||
|
-- Remove the timer of auto delay.
|
||||||
|
timers.auto_delay:kill()
|
||||||
|
timers.auto_delay = nil
|
||||||
|
end
|
||||||
|
)
|
||||||
|
else
|
||||||
|
detect_crop()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function on_toggle()
|
||||||
|
|
||||||
|
-- If it is during auto_delay, kill the timer.
|
||||||
|
if timers.auto_delay then
|
||||||
|
timers.auto_delay:kill()
|
||||||
|
timers.auto_delay = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Cropped => Remove it.
|
||||||
|
if remove_filter(labels.crop) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Detecting => Leave it.
|
||||||
|
if timers.detect_crop then
|
||||||
|
mp.msg.warn("Already cropdetecting!")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Neither => Do delectcrop.
|
||||||
|
detect_crop()
|
||||||
|
end
|
||||||
|
|
||||||
|
mp.add_key_binding("C", "toggle_crop", on_toggle)
|
||||||
|
mp.register_event("end-file", cleanup)
|
||||||
|
mp.register_event("file-loaded", on_start)
|
||||||
@@ -19,6 +19,7 @@ function on_load()
|
|||||||
match = match:gsub("^https://korone.aidoru.agency", "https://"..settings.username..":"..settings.password.."@korone.aidoru.agency")
|
match = match:gsub("^https://korone.aidoru.agency", "https://"..settings.username..":"..settings.password.."@korone.aidoru.agency")
|
||||||
match = match:gsub("^https://yuyuko.butaishoujo.moe", "https://"..settings.username..":"..settings.password.."@yuyuko.butaishoujo.moe")
|
match = match:gsub("^https://yuyuko.butaishoujo.moe", "https://"..settings.username..":"..settings.password.."@yuyuko.butaishoujo.moe")
|
||||||
match = match:gsub("^https://projo.yuru.moe", "https://"..settings.username..":"..settings.password.."@projo.yuru.moe")
|
match = match:gsub("^https://projo.yuru.moe", "https://"..settings.username..":"..settings.password.."@projo.yuru.moe")
|
||||||
|
match = match:gsub("^https://gungnir.dato.moe", "https://"..settings.username..":"..settings.password.."@gungnir.dato.moe")
|
||||||
match = match:gsub("^https://projection", settings.projo_host)
|
match = match:gsub("^https://projection", settings.projo_host)
|
||||||
if match ~= path then
|
if match ~= path then
|
||||||
if is_projo(path) then
|
if is_projo(path) then
|
||||||
|
|||||||
@@ -1,675 +0,0 @@
|
|||||||
-- repl.lua -- A graphical REPL for mpv input commands
|
|
||||||
--
|
|
||||||
-- © 2016, James Ross-Gowan
|
|
||||||
--
|
|
||||||
-- Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
-- purpose with or without fee is hereby granted, provided that the above
|
|
||||||
-- copyright notice and this permission notice appear in all copies.
|
|
||||||
--
|
|
||||||
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
|
||||||
-- SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
|
||||||
-- OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
|
||||||
-- CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
|
|
||||||
local utils = require 'mp.utils'
|
|
||||||
local options = require 'mp.options'
|
|
||||||
local assdraw = require 'mp.assdraw'
|
|
||||||
|
|
||||||
-- Default options
|
|
||||||
local opts = {
|
|
||||||
-- All drawing is scaled by this value, including the text borders and the
|
|
||||||
-- cursor. Change it if you have a high-DPI display.
|
|
||||||
scale = 1,
|
|
||||||
-- Set the font used for the REPL and the console. This probably doesn't
|
|
||||||
-- have to be a monospaced font.
|
|
||||||
font = 'monospace',
|
|
||||||
-- Set the font size used for the REPL and the console. This will be
|
|
||||||
-- multiplied by "scale."
|
|
||||||
['font-size'] = 16,
|
|
||||||
}
|
|
||||||
|
|
||||||
function detect_platform()
|
|
||||||
local o = {}
|
|
||||||
-- Kind of a dumb way of detecting the platform but whatever
|
|
||||||
if mp.get_property_native('options/vo-mmcss-profile', o) ~= o then
|
|
||||||
return 'windows'
|
|
||||||
elseif mp.get_property_native('options/cocoa-force-dedicated-gpu', o) ~= o then
|
|
||||||
return 'macos'
|
|
||||||
end
|
|
||||||
return 'linux'
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Pick a better default font for Windows and macOS
|
|
||||||
local platform = detect_platform()
|
|
||||||
if platform == 'windows' then
|
|
||||||
opts.font = 'Consolas'
|
|
||||||
elseif platform == 'macos' then
|
|
||||||
opts.font = 'Menlo'
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Apply user-set options
|
|
||||||
options.read_options(opts)
|
|
||||||
|
|
||||||
-- Build a list of commands, properties and options for tab-completion
|
|
||||||
local option_info = {
|
|
||||||
'name', 'type', 'set-from-commandline', 'set-locally', 'default-value',
|
|
||||||
'min', 'max', 'choices',
|
|
||||||
}
|
|
||||||
local cmd_list = {
|
|
||||||
'ignore', 'seek', 'revert-seek', 'quit', 'quit-watch-later', 'stop',
|
|
||||||
'frame-step', 'frame-back-step', 'playlist-next', 'playlist-prev',
|
|
||||||
'playlist-shuffle', 'sub-step', 'sub-seek', 'osd', 'print-text',
|
|
||||||
'show-text', 'show-progress', 'sub-add', 'sub-remove', 'sub-reload',
|
|
||||||
'tv-last-channel', 'screenshot', 'screenshot-to-file', 'screenshot-raw',
|
|
||||||
'loadfile', 'loadlist', 'playlist-clear', 'playlist-remove',
|
|
||||||
'playlist-move', 'run', 'set', 'add', 'cycle', 'multiply', 'cycle-values',
|
|
||||||
'enable-section', 'disable-section', 'define-section', 'ab-loop',
|
|
||||||
'drop-buffers', 'af', 'af-command', 'ao-reload', 'vf', 'vf-command',
|
|
||||||
'script-binding', 'script-message', 'script-message-to', 'overlay-add',
|
|
||||||
'overlay-remove', 'write-watch-later-config', 'hook-add', 'hook-ack',
|
|
||||||
'mouse', 'keypress', 'keydown', 'keyup', 'audio-add', 'audio-remove',
|
|
||||||
'audio-reload', 'rescan-external-file', 'apply-profile', 'load-script',
|
|
||||||
}
|
|
||||||
local prop_list = mp.get_property_native('property-list')
|
|
||||||
for _, opt in ipairs(mp.get_property_native('options')) do
|
|
||||||
prop_list[#prop_list + 1] = 'options/' .. opt
|
|
||||||
prop_list[#prop_list + 1] = 'file-local-options/' .. opt
|
|
||||||
prop_list[#prop_list + 1] = 'option-info/' .. opt
|
|
||||||
for _, p in ipairs(option_info) do
|
|
||||||
prop_list[#prop_list + 1] = 'option-info/' .. opt .. '/' .. p
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local repl_active = false
|
|
||||||
local insert_mode = false
|
|
||||||
local line = ''
|
|
||||||
local cursor = 1
|
|
||||||
local history = {}
|
|
||||||
local history_pos = 1
|
|
||||||
local log_ring = {}
|
|
||||||
|
|
||||||
-- Add a line to the log buffer (which is limited to 100 lines)
|
|
||||||
function log_add(style, text)
|
|
||||||
log_ring[#log_ring + 1] = { style = style, text = text }
|
|
||||||
if #log_ring > 100 then
|
|
||||||
table.remove(log_ring, 1)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Escape a string for verbatim display on the OSD
|
|
||||||
function ass_escape(str)
|
|
||||||
-- There is no escape for '\' in ASS (I think?) but '\' is used verbatim if
|
|
||||||
-- it isn't followed by a recognised character, so add a zero-width
|
|
||||||
-- non-breaking space
|
|
||||||
str = str:gsub('\\', '\\\239\187\191')
|
|
||||||
str = str:gsub('{', '\\{')
|
|
||||||
str = str:gsub('}', '\\}')
|
|
||||||
-- Precede newlines with a ZWNBSP to prevent ASS's weird collapsing of
|
|
||||||
-- consecutive newlines
|
|
||||||
str = str:gsub('\n', '\239\187\191\\N')
|
|
||||||
return str
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Render the REPL and console as an ASS OSD
|
|
||||||
function update()
|
|
||||||
local screenx, screeny, aspect = mp.get_osd_size()
|
|
||||||
screenx = screenx / opts.scale
|
|
||||||
screeny = screeny / opts.scale
|
|
||||||
|
|
||||||
-- Clear the OSD if the REPL is not active
|
|
||||||
if not repl_active then
|
|
||||||
mp.set_osd_ass(screenx, screeny, '')
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local ass = assdraw.ass_new()
|
|
||||||
local style = '{\\r' ..
|
|
||||||
'\\1a&H00&\\3a&H00&\\4a&H99&' ..
|
|
||||||
'\\1c&Heeeeee&\\3c&H111111&\\4c&H000000&' ..
|
|
||||||
'\\fn' .. opts.font .. '\\fs' .. opts['font-size'] ..
|
|
||||||
'\\bord2\\xshad0\\yshad1\\fsp0\\q1}'
|
|
||||||
-- Create the cursor glyph as an ASS drawing. ASS will draw the cursor
|
|
||||||
-- inline with the surrounding text, but it sets the advance to the width
|
|
||||||
-- of the drawing. So the cursor doesn't affect layout too much, make it as
|
|
||||||
-- thin as possible and make it appear to be 1px wide by giving it 0.5px
|
|
||||||
-- horizontal borders.
|
|
||||||
local cheight = opts['font-size'] * 8
|
|
||||||
local cglyph = '{\\r' ..
|
|
||||||
'\\1a&H44&\\3a&H44&\\4a&H99&' ..
|
|
||||||
'\\1c&Heeeeee&\\3c&Heeeeee&\\4c&H000000&' ..
|
|
||||||
'\\xbord0.5\\ybord0\\xshad0\\yshad1\\p4\\pbo24}' ..
|
|
||||||
'm 0 0 l 1 0 l 1 ' .. cheight .. ' l 0 ' .. cheight ..
|
|
||||||
'{\\p0}'
|
|
||||||
local before_cur = ass_escape(line:sub(1, cursor - 1))
|
|
||||||
local after_cur = ass_escape(line:sub(cursor))
|
|
||||||
|
|
||||||
-- Render log messages as ASS. This will render at most screeny / font-size
|
|
||||||
-- messages.
|
|
||||||
local log_ass = ''
|
|
||||||
local log_messages = #log_ring
|
|
||||||
local log_max_lines = math.ceil(screeny / opts['font-size'])
|
|
||||||
if log_max_lines < log_messages then
|
|
||||||
log_messages = log_max_lines
|
|
||||||
end
|
|
||||||
for i = #log_ring - log_messages + 1, #log_ring do
|
|
||||||
log_ass = log_ass .. style .. log_ring[i].style .. ass_escape(log_ring[i].text)
|
|
||||||
end
|
|
||||||
|
|
||||||
ass:new_event()
|
|
||||||
ass:an(1)
|
|
||||||
ass:pos(2, screeny - 2)
|
|
||||||
ass:append(log_ass .. '\\N')
|
|
||||||
ass:append(style .. '> ' .. before_cur)
|
|
||||||
ass:append(cglyph)
|
|
||||||
ass:append(style .. after_cur)
|
|
||||||
|
|
||||||
-- Redraw the cursor with the REPL text invisible. This will make the
|
|
||||||
-- cursor appear in front of the text.
|
|
||||||
ass:new_event()
|
|
||||||
ass:an(1)
|
|
||||||
ass:pos(2, screeny - 2)
|
|
||||||
ass:append(style .. '{\\alpha&HFF&}> ' .. before_cur)
|
|
||||||
ass:append(cglyph)
|
|
||||||
ass:append(style .. '{\\alpha&HFF&}' .. after_cur)
|
|
||||||
|
|
||||||
mp.set_osd_ass(screenx, screeny, ass.text)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Set the REPL visibility (`, Esc)
|
|
||||||
function set_active(active)
|
|
||||||
if active == repl_active then return end
|
|
||||||
if active then
|
|
||||||
repl_active = true
|
|
||||||
insert_mode = false
|
|
||||||
mp.enable_key_bindings('repl-input', 'allow-hide-cursor+allow-vo-dragging')
|
|
||||||
else
|
|
||||||
repl_active = false
|
|
||||||
mp.disable_key_bindings('repl-input')
|
|
||||||
end
|
|
||||||
update()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Show the repl if hidden and replace its contents with 'text'
|
|
||||||
-- (script-message-to repl type)
|
|
||||||
function show_and_type(text)
|
|
||||||
text = text or ''
|
|
||||||
|
|
||||||
-- Save the line currently being edited, just in case
|
|
||||||
if line ~= text and line ~= '' and history[#history] ~= line then
|
|
||||||
history[#history + 1] = line
|
|
||||||
end
|
|
||||||
|
|
||||||
line = text
|
|
||||||
cursor = line:len() + 1
|
|
||||||
history_pos = #history + 1
|
|
||||||
insert_mode = false
|
|
||||||
if repl_active then
|
|
||||||
update()
|
|
||||||
else
|
|
||||||
set_active(true)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Naive helper function to find the next UTF-8 character in 'str' after 'pos'
|
|
||||||
-- by skipping continuation bytes. Assumes 'str' contains valid UTF-8.
|
|
||||||
function next_utf8(str, pos)
|
|
||||||
if pos > str:len() then return pos end
|
|
||||||
repeat
|
|
||||||
pos = pos + 1
|
|
||||||
until pos > str:len() or str:byte(pos) < 0x80 or str:byte(pos) > 0xbf
|
|
||||||
return pos
|
|
||||||
end
|
|
||||||
|
|
||||||
-- As above, but finds the previous UTF-8 charcter in 'str' before 'pos'
|
|
||||||
function prev_utf8(str, pos)
|
|
||||||
if pos <= 1 then return pos end
|
|
||||||
repeat
|
|
||||||
pos = pos - 1
|
|
||||||
until pos <= 1 or str:byte(pos) < 0x80 or str:byte(pos) > 0xbf
|
|
||||||
return pos
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Insert a character at the current cursor position (' '-'~', Shift+Enter)
|
|
||||||
function handle_char_input(c)
|
|
||||||
if insert_mode then
|
|
||||||
line = line:sub(1, cursor - 1) .. c .. line:sub(next_utf8(line, cursor))
|
|
||||||
else
|
|
||||||
line = line:sub(1, cursor - 1) .. c .. line:sub(cursor)
|
|
||||||
end
|
|
||||||
cursor = cursor + 1
|
|
||||||
update()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Remove the character behind the cursor (Backspace)
|
|
||||||
function handle_backspace()
|
|
||||||
if cursor <= 1 then return end
|
|
||||||
local prev = prev_utf8(line, cursor)
|
|
||||||
line = line:sub(1, prev - 1) .. line:sub(cursor)
|
|
||||||
cursor = prev
|
|
||||||
update()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Remove the character in front of the cursor (Del)
|
|
||||||
function handle_del()
|
|
||||||
if cursor > line:len() then return end
|
|
||||||
line = line:sub(1, cursor - 1) .. line:sub(next_utf8(line, cursor))
|
|
||||||
update()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Toggle insert mode (Ins)
|
|
||||||
function handle_ins()
|
|
||||||
insert_mode = not insert_mode
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Move the cursor to the next character (Right)
|
|
||||||
function next_char(amount)
|
|
||||||
cursor = next_utf8(line, cursor)
|
|
||||||
update()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Move the cursor to the previous character (Left)
|
|
||||||
function prev_char(amount)
|
|
||||||
cursor = prev_utf8(line, cursor)
|
|
||||||
update()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Clear the current line (Ctrl+C)
|
|
||||||
function clear()
|
|
||||||
line = ''
|
|
||||||
cursor = 1
|
|
||||||
insert_mode = false
|
|
||||||
history_pos = #history + 1
|
|
||||||
update()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Close the REPL if the current line is empty, otherwise do nothing (Ctrl+D)
|
|
||||||
function maybe_exit()
|
|
||||||
if line == '' then
|
|
||||||
set_active(false)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Run the current command and clear the line (Enter)
|
|
||||||
function handle_enter()
|
|
||||||
if line == '' then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
if history[#history] ~= line then
|
|
||||||
history[#history + 1] = line
|
|
||||||
end
|
|
||||||
|
|
||||||
mp.command(line)
|
|
||||||
clear()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Go to the specified position in the command history
|
|
||||||
function go_history(new_pos)
|
|
||||||
local old_pos = history_pos
|
|
||||||
history_pos = new_pos
|
|
||||||
|
|
||||||
-- Restrict the position to a legal value
|
|
||||||
if history_pos > #history + 1 then
|
|
||||||
history_pos = #history + 1
|
|
||||||
elseif history_pos < 1 then
|
|
||||||
history_pos = 1
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Do nothing if the history position didn't actually change
|
|
||||||
if history_pos == old_pos then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- If the user was editing a non-history line, save it as the last history
|
|
||||||
-- entry. This makes it much less frustrating to accidentally hit Up/Down
|
|
||||||
-- while editing a line.
|
|
||||||
if old_pos == #history + 1 and line ~= '' and history[#history] ~= line then
|
|
||||||
history[#history + 1] = line
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Now show the history line (or a blank line for #history + 1)
|
|
||||||
if history_pos <= #history then
|
|
||||||
line = history[history_pos]
|
|
||||||
else
|
|
||||||
line = ''
|
|
||||||
end
|
|
||||||
cursor = line:len() + 1
|
|
||||||
insert_mode = false
|
|
||||||
update()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Go to the specified relative position in the command history (Up, Down)
|
|
||||||
function move_history(amount)
|
|
||||||
go_history(history_pos + amount)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Go to the first command in the command history (PgUp)
|
|
||||||
function handle_pgup()
|
|
||||||
go_history(1)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Stop browsing history and start editing a blank line (PgDown)
|
|
||||||
function handle_pgdown()
|
|
||||||
go_history(#history + 1)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Move to the start of the current word, or if already at the start, the start
|
|
||||||
-- of the previous word. (Ctrl+Left)
|
|
||||||
function prev_word()
|
|
||||||
-- This is basically the same as next_word() but backwards, so reverse the
|
|
||||||
-- string in order to do a "backwards" find. This wouldn't be as annoying
|
|
||||||
-- to do if Lua didn't insist on 1-based indexing.
|
|
||||||
cursor = line:len() - select(2, line:reverse():find('%s*[^%s]*', line:len() - cursor + 2)) + 1
|
|
||||||
update()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Move to the end of the current word, or if already at the end, the end of
|
|
||||||
-- the next word. (Ctrl+Right)
|
|
||||||
function next_word()
|
|
||||||
cursor = select(2, line:find('%s*[^%s]*', cursor)) + 1
|
|
||||||
update()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- List of tab-completions:
|
|
||||||
-- pattern: A Lua pattern used in string:find. Should return the start and
|
|
||||||
-- end positions of the word to be completed in the first and second
|
|
||||||
-- capture groups (using the empty parenthesis notation "()")
|
|
||||||
-- list: A list of candidate completion values.
|
|
||||||
-- append: An extra string to be appended to the end of a successful
|
|
||||||
-- completion. It is only appended if 'list' contains exactly one
|
|
||||||
-- match.
|
|
||||||
local completers = {
|
|
||||||
{ pattern = '^%s*()[%w_-]+()$', list = cmd_list, append = ' ' },
|
|
||||||
{ pattern = '^%s*set%s+()[%w_/-]+()$', list = prop_list, append = ' ' },
|
|
||||||
{ pattern = '^%s*set%s+"()[%w_/-]+()$', list = prop_list, append = '" ' },
|
|
||||||
{ pattern = '^%s*add%s+()[%w_/-]+()$', list = prop_list, append = ' ' },
|
|
||||||
{ pattern = '^%s*add%s+"()[%w_/-]+()$', list = prop_list, append = '" ' },
|
|
||||||
{ pattern = '^%s*cycle%s+()[%w_/-]+()$', list = prop_list, append = ' ' },
|
|
||||||
{ pattern = '^%s*cycle%s+"()[%w_/-]+()$', list = prop_list, append = '" ' },
|
|
||||||
{ pattern = '^%s*multiply%s+()[%w_/-]+()$', list = prop_list, append = ' ' },
|
|
||||||
{ pattern = '^%s*multiply%s+"()[%w_/-]+()$', list = prop_list, append = '" ' },
|
|
||||||
{ pattern = '${()[%w_/-]+()$', list = prop_list, append = '}' },
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Use 'list' to find possible tab-completions for 'part.' Returns the longest
|
|
||||||
-- common prefix of all the matching list items and a flag that indicates
|
|
||||||
-- whether the match was unique or not.
|
|
||||||
function complete_match(part, list)
|
|
||||||
local completion = nil
|
|
||||||
local full_match = false
|
|
||||||
|
|
||||||
for _, candidate in ipairs(list) do
|
|
||||||
if candidate:sub(1, part:len()) == part then
|
|
||||||
if completion and completion ~= candidate then
|
|
||||||
local prefix_len = part:len()
|
|
||||||
while completion:sub(1, prefix_len + 1)
|
|
||||||
== candidate:sub(1, prefix_len + 1) do
|
|
||||||
prefix_len = prefix_len + 1
|
|
||||||
end
|
|
||||||
completion = candidate:sub(1, prefix_len)
|
|
||||||
full_match = false
|
|
||||||
else
|
|
||||||
completion = candidate
|
|
||||||
full_match = true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return completion, full_match
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Complete the option or property at the cursor (TAB)
|
|
||||||
function complete()
|
|
||||||
local before_cur = line:sub(1, cursor - 1)
|
|
||||||
local after_cur = line:sub(cursor)
|
|
||||||
|
|
||||||
-- Try the first completer that works
|
|
||||||
for _, completer in ipairs(completers) do
|
|
||||||
-- Completer patterns should return the start and end of the word to be
|
|
||||||
-- completed as the first and second capture groups
|
|
||||||
local _, _, s, e = before_cur:find(completer.pattern)
|
|
||||||
if not s then
|
|
||||||
-- Multiple input commands can be separated by semicolons, so all
|
|
||||||
-- completions that are anchored at the start of the string with
|
|
||||||
-- '^' can start from a semicolon as well. Replace ^ with ; and try
|
|
||||||
-- to match again.
|
|
||||||
_, _, s, e = before_cur:find(completer.pattern:gsub('^^', ';'))
|
|
||||||
end
|
|
||||||
if s then
|
|
||||||
-- If the completer's pattern found a word, check the completer's
|
|
||||||
-- list for possible completions
|
|
||||||
local part = before_cur:sub(s, e)
|
|
||||||
local c, full = complete_match(part, completer.list)
|
|
||||||
if c then
|
|
||||||
-- If there was only one full match from the list, add
|
|
||||||
-- completer.append to the final string. This is normally a
|
|
||||||
-- space or a quotation mark followed by a space.
|
|
||||||
if full and completer.append then
|
|
||||||
c = c .. completer.append
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Insert the completion and update
|
|
||||||
before_cur = before_cur:sub(1, s - 1) .. c
|
|
||||||
cursor = before_cur:len() + 1
|
|
||||||
line = before_cur .. after_cur
|
|
||||||
update()
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Move the cursor to the beginning of the line (HOME)
|
|
||||||
function go_home()
|
|
||||||
cursor = 1
|
|
||||||
update()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Move the cursor to the end of the line (END)
|
|
||||||
function go_end()
|
|
||||||
cursor = line:len() + 1
|
|
||||||
update()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Delete from the cursor to the end of the word (Ctrl+W)
|
|
||||||
function del_word()
|
|
||||||
local before_cur = line:sub(1, cursor - 1)
|
|
||||||
local after_cur = line:sub(cursor)
|
|
||||||
|
|
||||||
before_cur = before_cur:gsub('[^%s]+%s*$', '', 1)
|
|
||||||
line = before_cur .. after_cur
|
|
||||||
cursor = before_cur:len() + 1
|
|
||||||
update()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Delete from the cursor to the end of the line (Ctrl+K)
|
|
||||||
function del_to_eol()
|
|
||||||
line = line:sub(1, cursor - 1)
|
|
||||||
update()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Delete from the cursor back to the start of the line (Ctrl+U)
|
|
||||||
function del_to_start()
|
|
||||||
line = line:sub(cursor)
|
|
||||||
cursor = 1
|
|
||||||
update()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Empty the log buffer of all messages (Ctrl+L)
|
|
||||||
function clear_log_buffer()
|
|
||||||
log_ring = {}
|
|
||||||
update()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Returns a string of UTF-8 text from the clipboard (or the primary selection)
|
|
||||||
function get_clipboard(clip)
|
|
||||||
if platform == 'linux' then
|
|
||||||
local res = utils.subprocess({
|
|
||||||
args = { 'xclip', '-selection', clip and 'clipboard' or 'primary', '-out' },
|
|
||||||
playback_only = false,
|
|
||||||
})
|
|
||||||
if not res.error then
|
|
||||||
return res.stdout
|
|
||||||
end
|
|
||||||
elseif platform == 'windows' then
|
|
||||||
local res = utils.subprocess({
|
|
||||||
args = { 'powershell', '-NoProfile', '-Command', [[& {
|
|
||||||
Trap {
|
|
||||||
Write-Error -ErrorRecord $_
|
|
||||||
Exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
$clip = ""
|
|
||||||
if (Get-Command "Get-Clipboard" -errorAction SilentlyContinue) {
|
|
||||||
$clip = Get-Clipboard -Raw -Format Text -TextFormatType UnicodeText
|
|
||||||
} else {
|
|
||||||
Add-Type -AssemblyName PresentationCore
|
|
||||||
$clip = [Windows.Clipboard]::GetText()
|
|
||||||
}
|
|
||||||
|
|
||||||
$clip = $clip -Replace "`r",""
|
|
||||||
$u8clip = [System.Text.Encoding]::UTF8.GetBytes($clip)
|
|
||||||
[Console]::OpenStandardOutput().Write($u8clip, 0, $u8clip.Length)
|
|
||||||
}]] },
|
|
||||||
playback_only = false,
|
|
||||||
})
|
|
||||||
if not res.error then
|
|
||||||
return res.stdout
|
|
||||||
end
|
|
||||||
elseif platform == 'macos' then
|
|
||||||
local res = utils.subprocess({
|
|
||||||
args = { 'pbpaste' },
|
|
||||||
playback_only = false,
|
|
||||||
})
|
|
||||||
if not res.error then
|
|
||||||
return res.stdout
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return ''
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Paste text from the window-system's clipboard. 'clip' determines whether the
|
|
||||||
-- clipboard or the primary selection buffer is used (on X11 only.)
|
|
||||||
function paste(clip)
|
|
||||||
local text = get_clipboard(clip)
|
|
||||||
local before_cur = line:sub(1, cursor - 1)
|
|
||||||
local after_cur = line:sub(cursor)
|
|
||||||
line = before_cur .. text .. after_cur
|
|
||||||
cursor = cursor + text:len()
|
|
||||||
update()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- The REPL has pretty specific requirements for key bindings that aren't
|
|
||||||
-- really satisified by any of mpv's helper methods, since they must be in
|
|
||||||
-- their own input section, but they must also raise events on key-repeat.
|
|
||||||
-- Hence, this function manually creates an input section and puts a list of
|
|
||||||
-- bindings in it.
|
|
||||||
function add_repl_bindings(bindings)
|
|
||||||
local cfg = ''
|
|
||||||
for i, binding in ipairs(bindings) do
|
|
||||||
local key = binding[1]
|
|
||||||
local fn = binding[2]
|
|
||||||
local name = '__repl_binding_' .. i
|
|
||||||
mp.add_key_binding(nil, name, fn, 'repeatable')
|
|
||||||
cfg = cfg .. key .. ' script-binding ' .. mp.script_name .. '/' ..
|
|
||||||
name .. '\n'
|
|
||||||
end
|
|
||||||
mp.commandv('define-section', 'repl-input', cfg, 'force')
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Mapping from characters to mpv key names
|
|
||||||
local binding_name_map = {
|
|
||||||
[' '] = 'SPACE',
|
|
||||||
['#'] = 'SHARP',
|
|
||||||
}
|
|
||||||
|
|
||||||
-- List of input bindings. This is a weird mashup between common GUI text-input
|
|
||||||
-- bindings and readline bindings.
|
|
||||||
local bindings = {
|
|
||||||
{ 'esc', function() set_active(false) end },
|
|
||||||
{ 'enter', handle_enter },
|
|
||||||
{ 'shift+enter', function() handle_char_input('\n') end },
|
|
||||||
{ 'bs', handle_backspace },
|
|
||||||
{ 'shift+bs', handle_backspace },
|
|
||||||
{ 'del', handle_del },
|
|
||||||
{ 'shift+del', handle_del },
|
|
||||||
{ 'ins', handle_ins },
|
|
||||||
{ 'shift+ins', function() paste(false) end },
|
|
||||||
{ 'mouse_btn1', function() paste(false) end },
|
|
||||||
{ 'left', function() prev_char() end },
|
|
||||||
{ 'right', function() next_char() end },
|
|
||||||
{ 'up', function() move_history(-1) end },
|
|
||||||
{ 'axis_up', function() move_history(-1) end },
|
|
||||||
{ 'mouse_btn3', function() move_history(-1) end },
|
|
||||||
{ 'down', function() move_history(1) end },
|
|
||||||
{ 'axis_down', function() move_history(1) end },
|
|
||||||
{ 'mouse_btn4', function() move_history(1) end },
|
|
||||||
{ 'axis_left', function() end },
|
|
||||||
{ 'axis_right', function() end },
|
|
||||||
{ 'ctrl+left', prev_word },
|
|
||||||
{ 'ctrl+right', next_word },
|
|
||||||
{ 'tab', complete },
|
|
||||||
{ 'home', go_home },
|
|
||||||
{ 'end', go_end },
|
|
||||||
{ 'pgup', handle_pgup },
|
|
||||||
{ 'pgdwn', handle_pgdown },
|
|
||||||
{ 'ctrl+c', clear },
|
|
||||||
{ 'ctrl+d', maybe_exit },
|
|
||||||
{ 'ctrl+k', del_to_eol },
|
|
||||||
{ 'ctrl+l', clear_log_buffer },
|
|
||||||
{ 'ctrl+u', del_to_start },
|
|
||||||
{ 'ctrl+v', function() paste(true) end },
|
|
||||||
{ 'meta+v', function() paste(true) end },
|
|
||||||
{ 'ctrl+w', del_word },
|
|
||||||
}
|
|
||||||
-- Add bindings for all the printable US-ASCII characters from ' ' to '~'
|
|
||||||
-- inclusive. Note, this is a pretty hacky way to do text input. mpv's input
|
|
||||||
-- system was designed for single-key key bindings rather than text input, so
|
|
||||||
-- things like dead-keys and non-ASCII input won't work. This is probably okay
|
|
||||||
-- though, since all mpv's commands and properties can be represented in ASCII.
|
|
||||||
for b = (' '):byte(), ('~'):byte() do
|
|
||||||
local c = string.char(b)
|
|
||||||
local binding = binding_name_map[c] or c
|
|
||||||
bindings[#bindings + 1] = {binding, function() handle_char_input(c) end}
|
|
||||||
end
|
|
||||||
add_repl_bindings(bindings)
|
|
||||||
|
|
||||||
-- Add a global binding for enabling the REPL. While it's enabled, its bindings
|
|
||||||
-- will take over and it can be closed with ESC.
|
|
||||||
mp.add_key_binding('œ', 'repl-enable', function()
|
|
||||||
set_active(true)
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- Add a script-message to show the REPL and fill it with the provided text
|
|
||||||
mp.register_script_message('type', function(text)
|
|
||||||
show_and_type(text)
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- Redraw the REPL when the OSD size changes. This is needed because the
|
|
||||||
-- PlayRes of the OSD will need to be adjusted.
|
|
||||||
mp.observe_property('osd-width', 'native', update)
|
|
||||||
mp.observe_property('osd-height', 'native', update)
|
|
||||||
|
|
||||||
-- Watch for log-messages and print them in the REPL console
|
|
||||||
mp.enable_messages('info')
|
|
||||||
mp.register_event('log-message', function(e)
|
|
||||||
-- Ignore log messages from the OSD because of paranoia, since writing them
|
|
||||||
-- to the OSD could generate more messages in an infinite loop.
|
|
||||||
if e.prefix:sub(1, 3) == 'osd' then return end
|
|
||||||
|
|
||||||
-- Use color for warn/error/fatal messages. Colors are stolen from base16
|
|
||||||
-- Eighties by Chris Kempson.
|
|
||||||
local style = ''
|
|
||||||
if e.level == 'warn' then
|
|
||||||
style = '{\\1c&H66ccff&}'
|
|
||||||
elseif e.level == 'error' then
|
|
||||||
style = '{\\1c&H7a77f2&}'
|
|
||||||
elseif e.level == 'fatal' then
|
|
||||||
style = '{\\1c&H5791f9&\\b1}'
|
|
||||||
end
|
|
||||||
|
|
||||||
log_add(style, '[' .. e.prefix .. '] ' .. e.text)
|
|
||||||
update()
|
|
||||||
end)
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
(import-macros {: packer-setup : use!} :hibiscus.packer)
|
(import-macros {: packer-setup! : use!} :hibiscus.packer)
|
||||||
(import-macros {: packer : setup} :macros)
|
(import-macros {: packer : setup} :macros)
|
||||||
|
|
||||||
(packer-setup)
|
(packer-setup!)
|
||||||
|
|
||||||
(packer
|
(packer
|
||||||
{:display {:open_fn (. (require :packer.util) :float)}}
|
{:display {:open_fn (. (require :packer.util) :float)}}
|
||||||
@@ -12,20 +12,20 @@
|
|||||||
(use! :udayvir-singh/hibiscus.nvim)
|
(use! :udayvir-singh/hibiscus.nvim)
|
||||||
|
|
||||||
(use! "~/.config/nvim/themes/solarized.nvim"
|
(use! "~/.config/nvim/themes/solarized.nvim"
|
||||||
:module :settings.solarized)
|
:require :settings.solarized)
|
||||||
|
|
||||||
(use! :nvim-treesitter/nvim-treesitter
|
(use! :nvim-treesitter/nvim-treesitter
|
||||||
:run (fn [] ((. (require :nvim-treesitter.install) :update) {:with_sync true}))
|
:run (fn [] ((. (require :nvim-treesitter.install) :update) {:with_sync true}))
|
||||||
:module :settings.treesitter)
|
:require :settings.treesitter)
|
||||||
|
|
||||||
(use! :feline-nvim/feline.nvim
|
(use! :feline-nvim/feline.nvim
|
||||||
:requires [:kyazdani42/nvim-web-devicons
|
:requires [:kyazdani42/nvim-web-devicons
|
||||||
"~/.config/nvim/themes/solarized.nvim"]
|
"~/.config/nvim/themes/solarized.nvim"]
|
||||||
:after [:solarized.nvim]
|
:after [:solarized.nvim]
|
||||||
:module :settings.feline)
|
:require :settings.feline)
|
||||||
|
|
||||||
(use! :s1n7ax/nvim-window-picker
|
(use! :s1n7ax/nvim-window-picker
|
||||||
:module :settings.window-picker)
|
:require :settings.window-picker)
|
||||||
|
|
||||||
(use! :nvim-neo-tree/neo-tree.nvim
|
(use! :nvim-neo-tree/neo-tree.nvim
|
||||||
:branch "v2.x"
|
:branch "v2.x"
|
||||||
@@ -37,13 +37,13 @@
|
|||||||
:edluffy/hologram.nvim]
|
:edluffy/hologram.nvim]
|
||||||
:after [:nvim-window-picker
|
:after [:nvim-window-picker
|
||||||
:hologram.nvim]
|
:hologram.nvim]
|
||||||
:module :settings.neo-tree)
|
:require :settings.neo-tree)
|
||||||
|
|
||||||
(use! :mrjones2014/smart-splits.nvim
|
(use! :mrjones2014/smart-splits.nvim
|
||||||
:module :settings.smart-splits)
|
:require :settings.smart-splits)
|
||||||
|
|
||||||
(use! :famiu/bufdelete.nvim
|
(use! :famiu/bufdelete.nvim
|
||||||
:module :bufdelete)
|
:require :bufdelete)
|
||||||
|
|
||||||
(use! :akinsho/bufferline.nvim
|
(use! :akinsho/bufferline.nvim
|
||||||
:tag "v2.*"
|
:tag "v2.*"
|
||||||
@@ -52,32 +52,32 @@
|
|||||||
"~/.config/nvim/themes/solarized.nvim"]
|
"~/.config/nvim/themes/solarized.nvim"]
|
||||||
:after [:bufdelete.nvim
|
:after [:bufdelete.nvim
|
||||||
:solarized.nvim]
|
:solarized.nvim]
|
||||||
:module :settings.bufferline)
|
:require :settings.bufferline)
|
||||||
|
|
||||||
(use! :windwp/nvim-autopairs
|
(use! :windwp/nvim-autopairs
|
||||||
:module :settings.autopairs)
|
:require :settings.autopairs)
|
||||||
|
|
||||||
(use! :lewis6991/gitsigns.nvim
|
(use! :lewis6991/gitsigns.nvim
|
||||||
:module :settings.gitsigns)
|
:require :settings.gitsigns)
|
||||||
|
|
||||||
(use! :declancm/cinnamon.nvim
|
(use! :declancm/cinnamon.nvim
|
||||||
:module :settings.cinnamon)
|
:require :settings.cinnamon)
|
||||||
|
|
||||||
(use! :stevearc/aerial.nvim
|
(use! :stevearc/aerial.nvim
|
||||||
:module :settings.aerial)
|
:require :settings.aerial)
|
||||||
|
|
||||||
(use! :nmac427/guess-indent.nvim
|
(use! :nmac427/guess-indent.nvim
|
||||||
:module :settings.guess-indent)
|
:require :settings.guess-indent)
|
||||||
|
|
||||||
(use! :nvim-telescope/telescope.nvim
|
(use! :nvim-telescope/telescope.nvim
|
||||||
:requires [:nvim-lua/plenary.nvim
|
:requires [:nvim-lua/plenary.nvim
|
||||||
:s1n7ax/nvim-window-picker]
|
:s1n7ax/nvim-window-picker]
|
||||||
:after [:nvim-window-picker]
|
:after [:nvim-window-picker]
|
||||||
:module :settings.telescope)
|
:require :settings.telescope)
|
||||||
|
|
||||||
(use! :sindrets/diffview.nvim
|
(use! :sindrets/diffview.nvim
|
||||||
:requires [:nvim-lua/plenary.nvim]
|
:requires [:nvim-lua/plenary.nvim]
|
||||||
:module :settings.diffview)
|
:require :settings.diffview)
|
||||||
|
|
||||||
(use! :neovim/nvim-lspconfig
|
(use! :neovim/nvim-lspconfig
|
||||||
:requires [:williamboman/mason-lspconfig.nvim
|
:requires [:williamboman/mason-lspconfig.nvim
|
||||||
@@ -89,24 +89,24 @@
|
|||||||
:saadparwaiz1/cmp_luasnip
|
:saadparwaiz1/cmp_luasnip
|
||||||
:rafamadriz/friendly-snippets
|
:rafamadriz/friendly-snippets
|
||||||
:L3MON4D3/LuaSnip]
|
:L3MON4D3/LuaSnip]
|
||||||
:module :settings.lspconfig)
|
:require :settings.lspconfig)
|
||||||
|
|
||||||
(use! :jose-elias-alvarez/null-ls.nvim
|
(use! :jose-elias-alvarez/null-ls.nvim
|
||||||
:module :settings.null-ls)
|
:require :settings.null-ls)
|
||||||
|
|
||||||
(use! :lervag/vimtex
|
(use! :lervag/vimtex
|
||||||
:module :settings.vimtex)
|
:require :settings.vimtex)
|
||||||
|
|
||||||
(use! :edluffy/hologram.nvim
|
(use! :edluffy/hologram.nvim
|
||||||
:module :settings.hologram)
|
:require :settings.hologram)
|
||||||
|
|
||||||
(use! :lambdalisue/suda.vim)
|
(use! :lambdalisue/suda.vim)
|
||||||
|
|
||||||
(use! :folke/noice.nvim
|
(use! :folke/noice.nvim
|
||||||
:event :VimEnter
|
:event :VimEnter
|
||||||
:requires [:MunifTanjim/nui.nvim]
|
:requires [:MunifTanjim/nui.nvim]
|
||||||
:module :settings.noice)
|
:require :settings.noice)
|
||||||
|
|
||||||
(use! :glacambre/firenvim
|
(use! :glacambre/firenvim
|
||||||
:run (fn [] ((. vim.fn :firenvim#install) 0))
|
:run (fn [] ((. vim.fn :firenvim#install) 0))
|
||||||
:module :settings.firenvim))
|
:require :settings.firenvim))
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
(import-macros {: exec : map!} :hibiscus.vim)
|
(import-macros {: exec! : map!} :hibiscus.vim)
|
||||||
|
|
||||||
(local M {})
|
(local M {})
|
||||||
|
|
||||||
@@ -58,15 +58,15 @@
|
|||||||
(fn [command _] (do_command (. command.arguments 1 :falsePositives) :hiddenFalsePositives)))
|
(fn [command _] (do_command (. command.arguments 1 :falsePositives) :hiddenFalsePositives)))
|
||||||
|
|
||||||
(fn post_attach []
|
(fn post_attach []
|
||||||
(exec [[:setlocal "spell"] [:setlocal "nospell"]])
|
(exec! [[:setlocal "spell"] [:setlocal "nospell"]])
|
||||||
(update_config "en-US" "dictionary")
|
(update_config "en-US" "dictionary")
|
||||||
(update_config "en-US" "disabledRules")
|
(update_config "en-US" "disabledRules")
|
||||||
(update_config "en-US" "hiddenFalsePositives")
|
(update_config "en-US" "hiddenFalsePositives")
|
||||||
(map! [n :buffer :verbose] :zug (fn [] (exec [[:normal! "zug"]])
|
(map! [n :buffer :verbose] :zug (fn [] (exec! [[:normal! "zug"]])
|
||||||
(update_config "en-US" "dictionary")
|
(update_config "en-US" "dictionary")
|
||||||
nil)
|
nil)
|
||||||
"Remove word from spellfile and update ltex")
|
"Remove word from spellfile and update ltex")
|
||||||
(map! [n :buffer :verbose] :zg (fn [] (exec [[:normal! "zg"]])
|
(map! [n :buffer :verbose] :zg (fn [] (exec! [[:normal! "zg"]])
|
||||||
(update_config "en-US" "dictionary")
|
(update_config "en-US" "dictionary")
|
||||||
nil)
|
nil)
|
||||||
"Add word to spellfile and update ltex")
|
"Add word to spellfile and update ltex")
|
||||||
|
|||||||
@@ -2,11 +2,13 @@
|
|||||||
(import-macros {: setup} :macros)
|
(import-macros {: setup} :macros)
|
||||||
|
|
||||||
(local servers
|
(local servers
|
||||||
[:eslint
|
[:bashls
|
||||||
|
:eslint
|
||||||
:gopls
|
:gopls
|
||||||
|
:java_language_server
|
||||||
:ltex
|
:ltex
|
||||||
|
:lua_ls
|
||||||
:pyright
|
:pyright
|
||||||
:sumneko_lua
|
|
||||||
:tsserver])
|
:tsserver])
|
||||||
|
|
||||||
; Mappings.
|
; Mappings.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
(import-macros {: g! : exec : map! : augroup!} :hibiscus.vim)
|
(import-macros {: g! : exec! : map! : augroup!} :hibiscus.vim)
|
||||||
(import-macros {: setup} :macros)
|
(import-macros {: setup} :macros)
|
||||||
|
|
||||||
(g! :neo_tree_remove_legacy_commands 1)
|
(g! :neo_tree_remove_legacy_commands 1)
|
||||||
@@ -14,8 +14,8 @@
|
|||||||
:window {:mappings {:/ "noop"
|
:window {:mappings {:/ "noop"
|
||||||
:g/ "fuzzy_finder"
|
:g/ "fuzzy_finder"
|
||||||
:f "noop"
|
:f "noop"
|
||||||
:ff (fn [] (exec [[:Telescope "find_files"]]))
|
:ff (fn [] (exec! [[:Telescope "find_files"]]))
|
||||||
:fg (fn [] (exec [[:Telescope "live_grep"]]))
|
:fg (fn [] (exec! [[:Telescope "live_grep"]]))
|
||||||
:<CR> "custom_open"
|
:<CR> "custom_open"
|
||||||
:e "open"
|
:e "open"
|
||||||
:<S-Right> (fn [])
|
:<S-Right> (fn [])
|
||||||
@@ -38,17 +38,17 @@
|
|||||||
:height (+ (math.ceil height) 1)
|
:height (+ (math.ceil height) 1)
|
||||||
:row 0
|
:row 0
|
||||||
:col 2})]
|
:col 2})]
|
||||||
(exec [[:setlocal "nonumber"]])
|
(exec! [[:setlocal "nonumber"]])
|
||||||
(vim.api.nvim_buf_attach bufnr false {:on_detach (fn [_ bufnr]
|
(vim.api.nvim_buf_attach bufnr false {:on_detach (fn [_ bufnr]
|
||||||
(image:delete bufnr {:free true}))})
|
(image:delete bufnr {:free true}))})
|
||||||
(image:display 1 0 bufnr {}))
|
(image:display 1 0 bufnr {}))
|
||||||
_ (do
|
_ (do
|
||||||
(exec [[:silent
|
(exec! [[:silent
|
||||||
"!file -bL --mime" quoted_path
|
"!file -bL --mime" quoted_path
|
||||||
"| grep -qv '^text\\|^inode\\|^application/json'"]])
|
"| grep -qv '^text\\|^inode\\|^application/json'"]])
|
||||||
(if (= vim.v.shell_error 1)
|
(if (= vim.v.shell_error 1)
|
||||||
((. (require :neo-tree.sources.filesystem.commands) :open_with_window_picker) state)
|
((. (require :neo-tree.sources.filesystem.commands) :open_with_window_picker) state)
|
||||||
(exec [[:silent
|
(exec! [[:silent
|
||||||
"!xdg-open" quoted_path
|
"!xdg-open" quoted_path
|
||||||
"&"]]))))))}}
|
"&"]]))))))}}
|
||||||
:renderers {:directory [[:indent]
|
:renderers {:directory [[:indent]
|
||||||
@@ -67,7 +67,7 @@
|
|||||||
[:git_status]]}})
|
[:git_status]]}})
|
||||||
|
|
||||||
(map! [n] :f ":Neotree focus<CR>")
|
(map! [n] :f ":Neotree focus<CR>")
|
||||||
(map! [n] :F (fn [] (exec [[:Neotree "toggle"] [:Neotree "toggle" "action=show"]])))
|
(map! [n] :F (fn [] (exec! [[:Neotree "toggle"] [:Neotree "toggle" "action=show"]])))
|
||||||
|
|
||||||
(augroup! :neo-tree [[FileType] [qf] "set nobuflisted|call feedkeys(\"F\")"])
|
(augroup! :neo-tree [[FileType] [qf] "set nobuflisted|call feedkeys(\"F\")"])
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
(setup :nvim-treesitter.configs
|
(setup :nvim-treesitter.configs
|
||||||
{:ensure_installed
|
{:ensure_installed
|
||||||
[:c
|
[:bash
|
||||||
|
:c
|
||||||
:fennel
|
:fennel
|
||||||
:java
|
:java
|
||||||
:javascript
|
:javascript
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
configuration {
|
||||||
|
modi: "run,mugen:~/.config/rofi/modi/mugen";
|
||||||
|
}
|
||||||
|
|
||||||
* {
|
* {
|
||||||
active-background: #20ABE0;
|
active-background: #20ABE0;
|
||||||
active-foreground: @foreground;
|
active-foreground: @foreground;
|
||||||
|
|||||||
27
.config/rofi/modi/mugen
Executable file
27
.config/rofi/modi/mugen
Executable file
@@ -0,0 +1,27 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
mugen_host=${MUGEN_HOST:-https://kara.moe}
|
||||||
|
kara_api="${MUGEN_KARA_API:-$mugen_host/api/karas}"
|
||||||
|
karamedia="${MUGEN_KARAOKEMEDIA:-$mugen_host/downloads}"
|
||||||
|
|
||||||
|
# karaoke medias and lyrics directories
|
||||||
|
medias="$karamedia/medias"
|
||||||
|
lyrics="$karamedia/lyrics"
|
||||||
|
|
||||||
|
kid=$ROFI_INFO
|
||||||
|
|
||||||
|
if [ -z "$@" ]; then
|
||||||
|
/usr/bin/printf "\0prompt\x1fkaraoke search\n"
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
if [ -z "$kid" ]; then
|
||||||
|
/usr/bin/printf "\0prompt\x1fmugen\n"
|
||||||
|
query="$(echo "$@" | tr " " "+")"
|
||||||
|
curl "https://kara.moe/api/karas/search?collections=dbcf2c22-524d-4708-99bb-601703633927,c7db86a0-ff64-4044-9be4-66dd1ef1d1c1,2fa2fe3f-bb56-45ee-aa38-eae60e76f224,efe171c0-e8a1-4d03-98c0-60ecf741ad52&filter=$query&size=100" | jq -r '.content | .[] | "\(.mediafile)\u0000info\u001f\(.kid)"'
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# choose karaoke
|
||||||
|
[ -z "$kid" ] && exit
|
||||||
|
|
||||||
|
umpv "https://kara.moe/kara/$kid" > /dev/null 2>&1 &
|
||||||
|
exec 1>&-
|
||||||
@@ -37,7 +37,12 @@ output "Dell Inc. DELL U2717D JXRPT83GAHKS" pos 1920 0 res 2560 1440
|
|||||||
#output "Dell Inc. DELL U2717D JXRPT83GAHKS" pos 1920 0 res 1920 1080
|
#output "Dell Inc. DELL U2717D JXRPT83GAHKS" pos 1920 0 res 1920 1080
|
||||||
output HDMI-A-3 pos 1920 0 res 1920 1080
|
output HDMI-A-3 pos 1920 0 res 1920 1080
|
||||||
output * bg ~/wallpapers/filianore-u.jpg fill
|
output * bg ~/wallpapers/filianore-u.jpg fill
|
||||||
|
output "Beihai Century Joint Innovation Technology Co.,Ltd MD49DQHD-2 0000000000000" pos 1920 0 res 5120 1440
|
||||||
focus output eDP-1
|
focus output eDP-1
|
||||||
|
|
||||||
|
bindswitch --reload --locked lid:on output eDP-1 disable
|
||||||
|
bindswitch --reload --locked lid:off output eDP-1 enable
|
||||||
|
|
||||||
#
|
#
|
||||||
# Example configuration:
|
# Example configuration:
|
||||||
#
|
#
|
||||||
@@ -285,7 +290,7 @@ include /etc/sway/config.d/*
|
|||||||
# Assignments
|
# Assignments
|
||||||
assign [class="discord"] workspace 3
|
assign [class="discord"] workspace 3
|
||||||
assign [class="Spotify"] workspace 3
|
assign [class="Spotify"] workspace 3
|
||||||
for_window [class="Spotify"] opacity 0.8
|
# for_window [class="Spotify"] opacity 0.8
|
||||||
for_window [app_id="boop-gtk"] floating enable
|
for_window [app_id="boop-gtk"] floating enable
|
||||||
|
|
||||||
#exec redshift -O 4500 -m wayland
|
#exec redshift -O 4500 -m wayland
|
||||||
@@ -297,6 +302,10 @@ exec ~/.config/sway/workspace_rename.py > ~/.cache/workspace_rename.log 2> ~/.ca
|
|||||||
|
|
||||||
for_window [class="Tor Browser"] floating enable
|
for_window [class="Tor Browser"] floating enable
|
||||||
|
|
||||||
|
for_window [class="steam_proton"] floating enable
|
||||||
|
|
||||||
|
for_window [app_id="mpv"] floating enable
|
||||||
|
|
||||||
for_window [app_id="kitty-scratch"] {
|
for_window [app_id="kitty-scratch"] {
|
||||||
border pixel 1
|
border pixel 1
|
||||||
}
|
}
|
||||||
@@ -313,7 +322,7 @@ workspace 2 output eDP-1
|
|||||||
|
|
||||||
workspace 3 output eDP-1
|
workspace 3 output eDP-1
|
||||||
exec discord
|
exec discord
|
||||||
exec spotify
|
exec spotify-launcher
|
||||||
|
|
||||||
exec xrdb -load ~/.Xresources
|
exec xrdb -load ~/.Xresources
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,30 @@
|
|||||||
[{
|
[{
|
||||||
"spacing": 4, // Gaps between modules (4px)
|
"spacing": 4, // Gaps between modules (4px)
|
||||||
"modules-left": ["sway/workspaces"],
|
"modules-left": ["sway/workspaces", "wlr/taskbar"],
|
||||||
|
"modules-center": [],
|
||||||
"modules-right": ["pulseaudio", "memory", "cpu", "battery", "network", "custom/pacman", "clock", "tray"],
|
"modules-right": ["pulseaudio", "memory", "cpu", "battery", "network", "custom/pacman", "clock", "tray"],
|
||||||
"memory": {
|
"memory": {
|
||||||
"format": "\uf538 {used:0.1f}GiB",
|
"format": "\uf538 {used:0.1f}GiB",
|
||||||
"on-click": "kitty --class kitty-scratch -c ~/.config/kitty/kitty-scratch.conf btop"
|
"on-click": "kitty --class kitty-scratch -c ~/.config/kitty/kitty-scratch.conf btop"
|
||||||
},
|
},
|
||||||
|
"sway/workspaces": {
|
||||||
|
"format": "{value}"
|
||||||
|
},
|
||||||
|
"wlr/taskbar": {
|
||||||
|
"on-click": "activate"
|
||||||
|
},
|
||||||
"tray": {
|
"tray": {
|
||||||
"spacing": 10
|
"spacing": 10
|
||||||
},
|
},
|
||||||
"clock": {
|
"clock": {
|
||||||
"tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>",
|
"tooltip-format": "<tt><small>{calendar}</small></tt>",
|
||||||
|
"calendar": {
|
||||||
|
"mode": "year",
|
||||||
|
"mode-mon-col": 3,
|
||||||
|
"format": {
|
||||||
|
"today": "<b><u>{}</u></b>"
|
||||||
|
}
|
||||||
|
},
|
||||||
"format": "\uf017 {:%A %d/%m/%Y %H:%M}"
|
"format": "\uf017 {:%A %d/%m/%Y %H:%M}"
|
||||||
},
|
},
|
||||||
"cpu": {
|
"cpu": {
|
||||||
|
|||||||
@@ -14,9 +14,39 @@ window#waybar.hidden {
|
|||||||
opacity: 0.2;
|
opacity: 0.2;
|
||||||
}
|
}
|
||||||
|
|
||||||
#workspaces button {
|
tooltip {
|
||||||
|
background-color: #002b36;
|
||||||
|
border: 1px solid #859900;
|
||||||
|
border-radius: 0px;
|
||||||
|
}
|
||||||
|
tooltip label {
|
||||||
|
color: #93a1a1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#taskbar {
|
||||||
|
margin-left: 10px;
|
||||||
|
padding: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#taskbar button {
|
||||||
|
padding: 0px;
|
||||||
|
box-shadow: inset 0 -3px transparent;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#taskbar button:hover {
|
||||||
|
background: inherit;
|
||||||
|
background-color: #268bd2;
|
||||||
|
-gtk-icon-shadow: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#taskbar button.active {
|
||||||
|
background-color: #859900;
|
||||||
|
}
|
||||||
|
|
||||||
|
#workspaces button {
|
||||||
|
color: #93a1a1;
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
background-color: transparent;
|
|
||||||
/* Use box-shadow instead of border so the text isn't offset */
|
/* Use box-shadow instead of border so the text isn't offset */
|
||||||
box-shadow: inset 0 -3px transparent;
|
box-shadow: inset 0 -3px transparent;
|
||||||
/* Avoid rounded borders under each workspace name */
|
/* Avoid rounded borders under each workspace name */
|
||||||
@@ -25,6 +55,8 @@ window#waybar.hidden {
|
|||||||
|
|
||||||
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
|
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
|
||||||
#workspaces button:hover {
|
#workspaces button:hover {
|
||||||
|
background: inherit;
|
||||||
|
text-shadow: none;
|
||||||
background-color: #268bd2;
|
background-color: #268bd2;
|
||||||
color: #002b36;
|
color: #002b36;
|
||||||
}
|
}
|
||||||
@@ -45,6 +77,7 @@ window#waybar.hidden {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#workspaces button,
|
#workspaces button,
|
||||||
|
#taskbar button,
|
||||||
#clock,
|
#clock,
|
||||||
#battery,
|
#battery,
|
||||||
#cpu,
|
#cpu,
|
||||||
@@ -66,7 +99,7 @@ window#waybar.hidden {
|
|||||||
|
|
||||||
#window,
|
#window,
|
||||||
#workspaces {
|
#workspaces {
|
||||||
margin: 0 4px;
|
margin: 0 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If workspaces is the leftmost module, omit left margin */
|
/* If workspaces is the leftmost module, omit left margin */
|
||||||
|
|||||||
19
.zshrc
19
.zshrc
@@ -36,4 +36,21 @@ if [ -f ~/.bash_aliases ]; then
|
|||||||
fi
|
fi
|
||||||
eval $(thefuck --alias)
|
eval $(thefuck --alias)
|
||||||
|
|
||||||
alias discord="export GDK_BACKEND=wayland && discord-canary"
|
#alias discord="export GDK_BACKEND=wayland && discord-canary"
|
||||||
|
|
||||||
|
# >>> mamba initialize >>>
|
||||||
|
# !! Contents within this block are managed by 'mamba init' !!
|
||||||
|
export MAMBA_EXE="/usr/bin/micromamba";
|
||||||
|
export MAMBA_ROOT_PREFIX="/home/rhiobet/.mamba";
|
||||||
|
__mamba_setup="$("$MAMBA_EXE" shell hook --shell zsh --prefix "$MAMBA_ROOT_PREFIX" 2> /dev/null)"
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
eval "$__mamba_setup"
|
||||||
|
else
|
||||||
|
if [ -f "/home/rhiobet/.mamba/etc/profile.d/micromamba.sh" ]; then
|
||||||
|
. "/home/rhiobet/.mamba/etc/profile.d/micromamba.sh"
|
||||||
|
else
|
||||||
|
export PATH="/home/rhiobet/.mamba/bin:$PATH" # extra space after export prevents interference from conda init
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
unset __mamba_setup
|
||||||
|
# <<< mamba initialize <<<
|
||||||
|
|||||||
Reference in New Issue
Block a user