add mpv configs

This commit is contained in:
Tibeuleu
2025-06-09 12:12:25 +02:00
parent 236572045c
commit 425074f498
7 changed files with 316 additions and 21 deletions

View File

@@ -1,5 +1,4 @@
# vim: filetype=i3
# File originally by Luke Smith <https://lukesmith.xyz>
# This config file will use environmental variables such as $BROWSER and $TERMINAL.
# You can set these variables in ~/.profile or ~/.bash_profile if you have it as below:
@@ -71,6 +70,7 @@ bindsym $mod+Shift+q [con_id="__focused__" instance="^(?!dropdown_).*$"] exec -
bindsym $mod+w exec --no-startup-id $BROWSER
bindsym $mod+Shift+w exec $term -e nmtui
bindsym $mod+Ctrl+w exec --no-startup-id qutebrowser
bindsym $mod+r exec --no-startup-id element-desktop
bindsym $mod+Shift+r exec --no-startup-id dmenuunicode
@@ -95,6 +95,7 @@ bindsym $mod+Shift+p exec --no-startup-id mpc stop
bindsym $mod+a exec --no-startup-id ddspawn dropdowncalc -f mono:pixelsize=24
bindsym $mod+Shift+a exec $term -e alsamixer
bindsym $mod+Ctrl+a exec $term -e pulsemixer
bindsym $mod+s exec --no-startup-id signal-desktop --use-tray-icon
bindsym $mod+Shift+s exec --no-startup-id slack
@@ -273,11 +274,11 @@ bindsym Shift+Print exec --no-startup-id maimpick
bindsym $mod+Print exec --no-startup-id dmenurecord
bindsym $mod+Shift+F12 exec --no-startup-id "killall screenkey || screenkey"
bindsym $mod+Delete exec $stoprec
bindsym XF86Launch1 exec --no-startup-id xset dpms force off
#bindsym XF86Launch1 exec --no-startup-id xset dpms force off
# #---Extra XF86 Keys---# #
bindsym XF86AudioMute exec --no-startup-id amixer sset Master toggle && pkill -RTMIN+10 i3blocks
bindsym XF86AudioMicMute exec --no-startup-id amixer sset Capture toggle
#bindsym XF86AudioMicMute exec --no-startup-id amixer sset Capture toggle
bindsym XF86AudioLowerVolume exec --no-startup-id amixer sset Master 5%- && pkill -RTMIN+10 i3blocks
bindsym Shift+XF86AudioLowerVolume exec --no-startup-id amixer sset Master 1%- && pkill -RTMIN+10 i3blocks
bindsym Control+XF86AudioLowerVolume exec --no-startup-id amixer sset Master 10%- && pkill -RTMIN+10 i3blocks
@@ -290,9 +291,9 @@ bindsym Control+XF86MonBrightnessDown exec --no-startup-id xbacklight -time 1000
bindsym XF86MonBrightnessUp exec --no-startup-id xbacklight -time 500 -steps 5 -inc 5
bindsym Shift+XF86MonBrightnessUp exec --no-startup-id xbacklight -time 100 -steps 1 -inc 1
bindsym Control+XF86MonBrightnessUp exec --no-startup-id xbacklight -time 1000 -steps 10 -inc 10
bindsym XF86Display exec --no-startup-id displayselect
bindsym XF86WLAN exec $nettoggle
bindsym XF86Bluetooth exec doas rfkill unblock bluetooth | $term bluetoothctl
#bindsym XF86Display exec --no-startup-id displayselect
#bindsym XF86WLAN exec $nettoggle
#bindsym XF86Bluetooth exec doas rfkill unblock bluetooth | $term bluetoothctl
##bindsym XF86Copy exec
##bindsym XF86Open exec
##bindsym XF86Paste exec
@@ -307,22 +308,22 @@ bindsym XF86PowerOff exec --no-startup-id sysact
##bindsym XF86Xfer exec
##bindsym XF86WWW exec --no-startup-id $BROWSER
##bindsym XF86DOS exec
bindsym XF86ScreenSaver exec exec --no-startup-id slock
#bindsym XF86ScreenSaver exec exec --no-startup-id slock
##bindsym XF86RotateWindows exec
##bindsym XF86TaskPane exec
##bindsym XF86Favorites exec
##bindsym XF86MyComputer exec $term -e lf
##bindsym XF86Back exec
##bindsym XF86Forward exec
bindsym XF86Eject exec --no-startup-id dmenuumount
bindsym XF86AudioNext exec --no-startup-id mpc next
bindsym XF86AudioPlay exec --no-startup-id mpc toggle
bindsym XF86AudioPrev exec --no-startup-id mpc prev
bindsym XF86AudioStop exec --no-startup-id mpc toggle
##bindsym XF86AudioRecord exec --no-startup-id $term -e ncmpcpp
bindsym XF86AudioRewind exec --no-startup-id mpc seek -10
bindsym XF86AudioForward exec --no-startup-id mpc seek +10
bindsym XF86AudioMedia exec --no-startup-id $term -e ncmpcpp
#bindsym XF86Eject exec --no-startup-id dmenuumount
#bindsym XF86AudioNext exec --no-startup-id mpc next
#bindsym XF86AudioPlay exec --no-startup-id mpc toggle
#bindsym XF86AudioPrev exec --no-startup-id mpc prev
#bindsym XF86AudioStop exec --no-startup-id mpc toggle
#bindsym XF86AudioRecord exec --no-startup-id $term -e ncmpcpp
#bindsym XF86AudioRewind exec --no-startup-id mpc seek -10
#bindsym XF86AudioForward exec --no-startup-id mpc seek +10
#bindsym XF86AudioMedia exec --no-startup-id $term -e ncmpcpp
##bindsym XF86Phone exec
##bindsym XF86Tools exec
##bindsym XF86HomePage exec $BROWSER
@@ -340,11 +341,11 @@ bindsym XF86AudioMedia exec --no-startup-id $term -e ncmpcpp
##bindsym XF86Launch7 exec
##bindsym XF86Launch8 exec
##bindsym XF86Launch9 exec
bindsym XF86TouchpadToggle exec --no-startup-id toggletouchpad
#bindsym XF86TouchpadToggle exec --no-startup-id toggletouchpad
#bindsym XF86TouchpadOn exec --no-startup-id synclient TouchpadOff=0
#bindsym XF86TouchpadOff exec --no-startup-id synclient TouchpadOff=1
bindsym XF86Suspend exec --no-startup-id lockscreen
bindsym XF86Close kill
#bindsym XF86Suspend exec --no-startup-id lockscreen
#bindsym XF86Close kill
#bindsym XF86WebCam exec --no-startup-id camtoggle
#bindsym XF86Mail exec --no-startup-id thunderbird
#bindsym XF86Messenger exec $term -e weechat

6
.config/mpv/input.conf Executable file
View File

@@ -0,0 +1,6 @@
l seek 5
h seek -5
j seek -60
k seek 60
S cycle sub
n cycle_values af loudnorm=I=-30 loudnorm=I=-15 anull

158
.config/mpv/mpv.conf Normal file
View File

@@ -0,0 +1,158 @@
#
# Example mpv configuration file
#
# Warning:
#
# The commented example options usually do _not_ set the default values. Call
# mpv with --list-options to see the default values for most options. There is
# no builtin or example mpv.conf with all the defaults.
#
#
# Configuration files are read system-wide from /etc/mpv or /usr/local/etc/mpv,
# and per-user from ~/.config/mpv, where per-user settings override
# system-wide settings, all of which are overridden by the command line.
#
# Configuration file settings and the command line options use the same
# underlying mechanisms. Most options can be put into the configuration file
# by dropping the preceding '--'. See the man page for a complete list of
# options.
#
# Lines starting with '#' are comments and are ignored.
#
# See the CONFIGURATION FILES section in the man page
# for a detailed description of the syntax.
#
# Profiles should be placed at the bottom of the configuration file to ensure
# that settings wanted as defaults are not restricted to specific profiles.
##################
# video settings #
##################
# Start in fullscreen mode by default.
#fs=yes
# force starting with centered window
#geometry=50%:50%
# don't allow a new window to have a size larger than 90% of the screen size
#autofit-larger=90%x90%
# Do not close the window on exit.
#keep-open=yes
# Do not wait with showing the video window until it has loaded. (This will
# resize the window once video is loaded. Also always shows a window with
# audio.)
#force-window=immediate
# Disable the On Screen Controller (OSC).
#osc=no
# Keep the player window on top of all other windows.
#ontop=yes
# Default video output to Xorg only
vo=xv
# Specify fast video rendering preset (for --vo=<gpu|gpu-next> only)
# Recommended for mobile devices or older hardware with limited processing power
#profile=fast
# Specify high quality video rendering preset (for --vo=<gpu|gpu-next> only)
# Offers superior image fidelity and visual quality for an enhanced viewing
# experience on capable hardware
#profile=high-quality
# Force video to lock on the display's refresh rate, and change video and audio
# speed to some degree to ensure synchronous playback - can cause problems
# with some drivers and desktop environments.
#video-sync=display-resample
# Enable hardware decoding if available. Often, this does not work with all
# video outputs, but should work well with default settings on most systems.
# If performance or energy usage is an issue, forcing the vdpau or vaapi VOs
# may or may not help.
hwdec=auto
##################
# audio settings #
##################
# Specify default audio device. You can list devices with: --audio-device=help
# The option takes the device string (the stuff between the '...').
#audio-device=alsa/default
# Do not filter audio to keep pitch when changing playback speed.
#audio-pitch-correction=no
# Output 5.1 audio natively, and upmix/downmix audio with a different format.
#audio-channels=5.1
# Disable any automatic remix, _if_ the audio output accepts the audio format.
# of the currently played file. See caveats mentioned in the manpage.
# (The default is "auto-safe", see manpage.)
#audio-channels=auto
##################
# other settings #
##################
#
screenshot-template="%F_%p-%#01n"
# automatically save the current playback position on quit
save-position-on-quit
# Pretend to be a web browser. Might fix playback with some streaming sites,
# but also will break with shoutcast streams.
#user-agent="Mozilla/5.0"
# cache settings
#
# Use a large seekable RAM cache even for local input.
#cache=yes
#
# Use extra large RAM cache (needs cache=yes to make it useful).
#demuxer-max-bytes=500M
#demuxer-max-back-bytes=100M
#
# Disable the behavior that the player will pause if the cache goes below a
# certain fill size.
#cache-pause=no
#
# Store cache payload on the hard disk instead of in RAM. (This may negatively
# impact performance unless used for slow input such as network.)
#cache-dir=~/.cache/
#cache-on-disk=yes
# Display English subtitles if available.
slang=en
# Play French audio if available, fall back to English otherwise.
alang=fr,en
# Change subtitle encoding. For Arabic subtitles use 'cp1256'.
# If the file seems to be valid UTF-8, prefer UTF-8.
# (You can add '+' in front of the codepage to force it.)
#sub-codepage=cp1256
# You can also include other configuration files.
#include=/path/to/the/file/you/want/to/include
############
# Profiles #
############
# The options declared as part of profiles override global default settings,
# but only take effect when the profile is active.
# The following profile can be enabled on the command line with: --profile=eye-cancer
#[eye-cancer]
#sharpen=5
#############
# Streaming #
#############
# Youtube Support
script-opts=ytdl_hook-ytdl_path=/usr/bin/yt-dlp
ytdl-format=bestvideo[height<=?1080][fps<=?30][vcodec!=?vp9]+bestaudio/best

View File

@@ -0,0 +1,130 @@
-- sponsorblock_minimal.lua
--
-- This script skips sponsored segments of YouTube videos
-- using data from https://github.com/ajayyy/SponsorBlock
local opt = require 'mp.options'
local utils = require 'mp.utils'
local ON = false
local ranges = nil
local options = {
server = "https://sponsor.ajay.app/api/skipSegments",
-- Categories to fetch and skip
categories = '"sponsor","intro","outro","interaction","selfpromo"',
-- Set this to "true" to use sha256HashPrefix instead of videoID
hash = ""
}
opt.read_options(options)
function skip_ads(name,pos)
if pos then
for _, i in pairs(ranges) do
v = i.segment[2]
if i.segment[1] <= pos and v > pos then
--this message may sometimes be wrong
--it only seems to be a visual thing though
mp.osd_message(("[sponsorblock] skipping forward %ds"):format(math.floor(v-mp.get_property("time-pos"))))
--need to do the +0.01 otherwise mpv will start spamming skip sometimes
--example: https://www.youtube.com/watch?v=4ypMJzeNooo
mp.set_property("time-pos",v+0.01)
return
end
end
end
end
function file_loaded()
local video_path = mp.get_property("path", "")
local video_referer = string.match(mp.get_property("http-header-fields", ""), "Referer:([^,]+)") or ""
local urls = {
"ytdl://youtu%.be/([%w-_]+).*",
"ytdl://w?w?w?%.?youtube%.com/v/([%w-_]+).*",
"https?://youtu%.be/([%w-_]+).*",
"https?://w?w?w?%.?youtube%.com/v/([%w-_]+).*",
"/watch.*[?&]v=([%w-_]+).*",
"/embed/([%w-_]+).*",
"^ytdl://([%w-_]+)$",
"-([%w-_]+)%."
}
local youtube_id = nil
local purl = mp.get_property("metadata/by-key/PURL", "")
for i,url in ipairs(urls) do
youtube_id = youtube_id or string.match(video_path, url) or string.match(video_referer, url) or string.match(purl, url)
if youtube_id then break end
end
if not youtube_id or string.len(youtube_id) < 11 then return end
youtube_id = string.sub(youtube_id, 1, 11)
local args = {"curl", "-L", "-s", "-G", "--data-urlencode", ("categories=[%s]"):format(options.categories)}
local url = options.server
if options.hash == "true" then
local sha = mp.command_native{
name = "subprocess",
capture_stdout = true,
args = {"sha256sum"},
stdin_data = youtube_id
}
url = ("%s/%s"):format(url, string.sub(sha.stdout, 0, 4))
else
table.insert(args, "--data-urlencode")
table.insert(args, "videoID=" .. youtube_id)
end
table.insert(args, url)
local sponsors = mp.command_native{
name = "subprocess",
capture_stdout = true,
playback_only = false,
args = args
}
if sponsors.stdout then
local json = utils.parse_json(sponsors.stdout)
if type(json) == "table" then
if options.hash == "true" then
for _, i in pairs(json) do
if i.videoID == youtube_id then
ranges = i.segments
break
end
end
else
ranges = json
end
if ranges then
ON = true
mp.add_key_binding("b","sponsorblock",toggle)
mp.observe_property("time-pos", "native", skip_ads)
end
end
end
end
function end_file()
if not ON then return end
mp.unobserve_property(skip_ads)
ranges = nil
ON = false
end
function toggle()
if ON then
mp.unobserve_property(skip_ads)
mp.osd_message("[sponsorblock] off")
ON = false
else
mp.observe_property("time-pos", "native", skip_ads)
mp.osd_message("[sponsorblock] on")
ON = true
end
end
mp.register_event("file-loaded", file_loaded)
mp.register_event("end-file", end_file)

View File

@@ -9,4 +9,4 @@ settings:
content.javascript.enabled:
global: true
statusbar.show:
global: never
global: always

View File

@@ -9,7 +9,6 @@
# source them here with the line below.
export STATUSBAR="i3blocks"
[[ -f ${XDG_CONFIG_HOME:-$HOME/.config}/x11/Xresources ]] && xrdb -merge -I${XDG_CONFIG_HOME:-$HOME/.config}/x11/Xresources
. ~/.xprofile
dbus-update-activation-environment DISPLAY XAUTHORITY WAYLAND_DISPLAY
ssh-agent i3

View File

@@ -13,6 +13,7 @@
# ! pidof pulseaudio >/dev/null &&
# setsid -f pulseaudio --start >/dev/null 2>&1
[[ -f ${XDG_CONFIG_HOME:-$HOME/.config}/x11/Xresources ]] && xrdb ${XDG_CONFIG_HOME:-$HOME/.config}/x11/Xresources
remaps & # run the remaps script, switching caps/esc and more; check it for more info
setbg & # set the background with the `setbg` script
mpd & # music player daemon-you might prefer it as a service though