summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarcellus <msimon_fr@hotmail.com>2023-05-04 00:13:20 +0200
committermarcellus <msimon_fr@hotmail.com>2023-05-04 00:13:20 +0200
commit13535011bb12163a4f9035cf2f231e856565e950 (patch)
treeda15860273c94d6f9dba02e7d9e5b7e9749438db
parent7e1032434d90db737e319d3eb21721b7fed388be (diff)
fix: overall patches
-rw-r--r--.gitignore4
-rw-r--r--dwmblocks/config6
-rw-r--r--fontconfig/fonts.conf2
-rw-r--r--mpv/input.conf6
-rw-r--r--mpv/music/local.lua30
-rw-r--r--mpv/music/online.lua9
-rw-r--r--mpv/scripts/sponsorblock_minimal.lua145
-rwxr-xr-xscripts/musiccmd6
-rw-r--r--sxhkd/sxhkdrc6
-rw-r--r--zsh/.zshenv7
10 files changed, 210 insertions, 11 deletions
diff --git a/.gitignore b/.gitignore
index d9840c3..6b195dd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,10 +8,14 @@ gtk-3.0/
procps/
dconf/
Tracktion/
+qBittorrent/
+vlc/
+MuseScore/
## trashfiles
.zcompdump
*~
+QtProject.conf
## other stuff
scummvm/
diff --git a/dwmblocks/config b/dwmblocks/config
index a0112c5..613e2de 100644
--- a/dwmblocks/config
+++ b/dwmblocks/config
@@ -1,8 +1,8 @@
/*Name State Update Signal + 34*/
-music = false // 35
+music = true // 35
cputemp = false // 36
fanspeed = false // 37
-memory = true // 38
+memory = false // 38
battery = true // 39
wifi = true // 40
ethernet = false // 41
@@ -13,6 +13,6 @@ mic = false // 45
news = false // 46
mail = false // 47
weather = false // 48
-daypercent = true // 49
+daypercent = false // 49
date = true // 50
time = true // 51
diff --git a/fontconfig/fonts.conf b/fontconfig/fonts.conf
index 6867100..903102f 100644
--- a/fontconfig/fonts.conf
+++ b/fontconfig/fonts.conf
@@ -25,7 +25,7 @@
<alias>
<family>monospace</family>
<prefer>
- <family> Cousine Nerd Font</family>
+ <family>Cousine Nerd Font</family>
<family>Noto Emoji</family>
</prefer>
</alias>
diff --git a/mpv/input.conf b/mpv/input.conf
new file mode 100644
index 0000000..c5065c7
--- /dev/null
+++ b/mpv/input.conf
@@ -0,0 +1,6 @@
+WHEEL_UP add volume 2
+WHEEL_DOWN add volume -2
+l seek 5
+h seek -5
+j seek 60
+k seek -60 \ No newline at end of file
diff --git a/mpv/music/local.lua b/mpv/music/local.lua
new file mode 100644
index 0000000..dfb9e2d
--- /dev/null
+++ b/mpv/music/local.lua
@@ -0,0 +1,30 @@
+local utils = require "mp.utils"
+
+function notify_current_media()
+ local path = mp.get_property_native("path")
+ local origin, title = utils.split_path(path)
+
+ local metadata = mp.get_property_native("metadata")
+ if metadata then
+ function tag(name)
+ return metadata[string.upper(name)] or metadata[name]
+ end
+
+ title = tag("title") or title
+ origin = tag("artist_credit") or tag("artist") or ""
+
+ local album = tag("album")
+ if album then
+ origin = string.format("%s — %s", origin, album)
+ end
+
+ local year = tag("original_year") or tag("year")
+ if year then
+ origin = string.format("%s (%s)", origin, year)
+ end
+ end
+ mp.command_native({"run", "pkill", "-RTMIN+1", "dwmblocks"})
+ return mp.command_native({"run", "env", "HERBE_ID=/music", "herbe", title, origin})
+end
+
+mp.register_event("file-loaded", notify_current_media) \ No newline at end of file
diff --git a/mpv/music/online.lua b/mpv/music/online.lua
new file mode 100644
index 0000000..bcd5d18
--- /dev/null
+++ b/mpv/music/online.lua
@@ -0,0 +1,9 @@
+local utils = require "mp.utils"
+
+function notify_current_media(key)
+ local title = mp.get_property(key)
+ mp.command_native({"run", "pkill", "-RTMIN+1", "dwmblocks"})
+ return mp.command_native({"run", "env", "HERBE_ID=/music", "herbe", title})
+end
+
+mp.observe_property("media-title", string, notify_current_media) \ No newline at end of file
diff --git a/mpv/scripts/sponsorblock_minimal.lua b/mpv/scripts/sponsorblock_minimal.lua
new file mode 100644
index 0000000..8ac0cca
--- /dev/null
+++ b/mpv/scripts/sponsorblock_minimal.lua
@@ -0,0 +1,145 @@
+-- sponsorblock_minimal.lua
+-- https://codeberg.org/jouni/mpv_sponsorblock_minimal
+-- LICENSE: GPLv3
+--
+-- b toggles between on/off
+--
+-- 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 options = {
+ server = "https://sponsor.ajay.app/api/skipSegments",
+
+ -- Categories to fetch and skip
+ categories = '"sponsor"',
+
+ -- Set this to "true" to use sha256HashPrefix instead of videoID
+ hash = ""
+}
+
+opt.read_options(options)
+
+function getranges(url)
+ local luacurl_available, cURL = pcall(require,'cURL')
+
+ local res = ""
+ if not(luacurl_available) then -- if Lua-cURL is not available on this system
+ local sponsors = mp.command_native{
+ name = "subprocess",
+ capture_stdout = true,
+ playback_only = false,
+ args = {"curl", "-L", "-s", "-g", url}
+ }
+ res = sponsors.stdout
+ else -- otherwise use Lua-cURL (binding to libcurl)
+ local buf={}
+ local c = cURL.easy_init()
+ c:setopt_followlocation(1)
+ c:setopt_url(url)
+ c:setopt_writefunction(function(chunk) table.insert(buf,chunk); return true; end)
+ c:perform()
+ res = table.concat(buf)
+ end
+
+ local json = utils.parse_json(res)
+ if options.hash == "true" and json ~= nil then
+ for _, i in pairs(json) do
+ if i.videoID == youtube_id then
+ return i.segments
+ end
+ end
+ else
+ return json
+ end
+
+ return nil
+end
+
+function skip_ads(name,pos)
+ if pos ~= nil 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
+ return
+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-_]+)%."
+ }
+ 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)
+ end
+
+ if not youtube_id or string.len(youtube_id) < 11 then return end
+ youtube_id = string.sub(youtube_id, 1, 11)
+
+ local url = ""
+ if options.hash == "true" then
+ local sha = mp.command_native{
+ name = "subprocess",
+ capture_stdout = true,
+ args = {"sha256sum"},
+ stdin_data = youtube_id
+ }
+ url = ("%s/%s?categories=[%s]"):format(options.server, string.sub(sha.stdout, 0, 4), options.categories)
+ else
+ url = ("%s?videoID=%s&categories=[%s]"):format(options.server, youtube_id, options.categories)
+ end
+
+ ranges = getranges(url)
+ if ranges ~= nil then
+ ON = true
+ mp.add_key_binding("b","sponsorblock",toggle)
+ mp.observe_property("time-pos", "native", skip_ads)
+ end
+ return
+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
+ return
+ end
+ mp.observe_property("time-pos", "native", skip_ads)
+ mp.osd_message("[sponsorblock] on")
+ ON = true
+ return
+end
+
+mp.register_event("file-loaded", file_loaded)
+mp.register_event("end-file", end_file) \ No newline at end of file
diff --git a/scripts/musiccmd b/scripts/musiccmd
index 73c961b..ecaf437 100755
--- a/scripts/musiccmd
+++ b/scripts/musiccmd
@@ -3,8 +3,8 @@
# dependencies: music, mpv, socat, yt-dlp, ffmpeg, imagemagick
# optional dependencies: dwmblocks, libnotify, herbe
-FAVDIR="${XDG_MUSIC_DIR:-$HOME/Music}/favorite"
-DLDIR="${XDG_MUSIC_DIR:-$HOME/Music}/download"
+FAVDIR="${XDG_MUSIC_DIR:-$HOME/music}/favorite"
+DLDIR="${XDG_MUSIC_DIR:-$HOME/music}/download"
CACHE="${XDG_CACHE_HOME:-$HOME/.cache}"
IMG="nsxiv"
@@ -113,4 +113,4 @@ main() {
esac
}
-main "$@" \ No newline at end of file
+main "$@"
diff --git a/sxhkd/sxhkdrc b/sxhkd/sxhkdrc
index 83ee55a..b20942c 100644
--- a/sxhkd/sxhkdrc
+++ b/sxhkd/sxhkdrc
@@ -17,8 +17,10 @@ XF86AudioMute
pamixer -t; kill
{F7,super + n,super + shift + n}
$TERMINAL -e {dmenurecord,lfub "$XDG_DATA_HOME/notes",newsboat}
-super + {m, shift + m}
- {music,musiccmd}
+{super + m, XF86Tools}
+ music
+super + shift + m
+ musiccmd
XF86Audio{Prev,Next,Play,Stop}
musiccmd {prev,next,cycle,stop}
super + {s,a,y,w,e}
diff --git a/zsh/.zshenv b/zsh/.zshenv
index 5ff4c81..c168554 100644
--- a/zsh/.zshenv
+++ b/zsh/.zshenv
@@ -1,2 +1,5 @@
-PATH="$HOME/.config/scripts:$PATH"
-TERMINAL="st"
+export PATH="$HOME/.config/scripts:$PATH"
+export TERMINAL="st"
+export EDITOR="emacs"
+
+export XDG_CONFIG_HOME="$HOME/.config"