Compare commits

...

73 Commits

Author SHA1 Message Date
a4a1f44e4e scanner: add wrapper script 2025-06-20 15:20:55 +02:00
93f5122723 a5ona4: fix and simplify script to work with newer pdflatex versions 2025-06-15 11:36:03 +02:00
951eebe79b dunst: update to new syntax 2024-12-09 18:17:40 +01:00
5bf85682ed nvim: fix vimtex not being able to start autocompiler due to airlatex 2024-10-25 14:52:24 +02:00
75e7744f01 startmpv: support rumble by first starting yt-dlp separately 2024-10-10 11:33:27 +02:00
56e4a5ebfb picom: fix unfocussed images being darker 2024-10-07 15:03:06 +02:00
76e72f4d46 mpv: printout marked files using the "M" key similar to sxiv 2024-09-20 10:31:32 +02:00
a73c95b3a6 papis: fix ref for jinja2 after PR has been merged 2024-09-19 11:42:06 +02:00
562a454d63 papis: fix author key read-in for now 2024-09-18 13:36:53 +02:00
1dcd003a8d papis: refs are <AuthorLastName><Year><Title15chars> 2024-09-18 12:34:47 +02:00
52af3677cf statusbar: fix vpnstatus not showing inside of ETH network (non-vpn) 2024-09-17 10:45:24 +02:00
c12e14fb65 nvim: no inlay hints for variables in python 2024-09-16 10:56:42 +02:00
7d07cb92de nvim: add coc-settings.json 2024-09-16 10:53:19 +02:00
4188c07932 statusbar: fix vpnstatus never showing 2024-09-09 15:17:43 +02:00
585f192551 papis: file-formatted to <year>-<first_author>-<title> 2024-08-25 14:50:41 +02:00
809a7210e0 mpd: persist queue between restarts using state file 2024-08-25 13:05:46 +02:00
162bce097d zathura: yank filename using "y" 2024-08-18 21:13:58 +02:00
ab72387a96 mbsync: move away from deprecated SSLType 2024-08-16 09:45:18 +02:00
69212cf836 mpv: yanking of title possible 2024-06-05 16:44:17 +02:00
5c345b8a8c mpv: custom yanker no new line 2024-06-04 21:28:01 +02:00
a2eaec5dba mpv: add full path to options 2024-06-04 21:11:12 +02:00
e104755b24 mpv: custom name and dir yanker 2024-06-04 20:54:33 +02:00
944a2bb4e8 dunst: remove icon 2024-05-29 10:33:45 +02:00
15a6065ec0 nvim: push latest state 2024-05-22 20:25:03 +02:00
f074a1c74e qutebrowser: open window on same location using <Alt-Return> like st, ranger, zathura, and mpv 2024-05-14 21:28:52 +02:00
4f8a4671d2 rifle: also open audio with mpv (wtf) 2024-05-01 07:39:28 +02:00
740ab0f2ad qutebrowser: update photoprism bulkedit for dates 2024-04-05 14:06:56 +02:00
1c0b5771e3 qutebrowser: inital version of photoprism bulk edit userscript 2024-04-05 14:01:20 +02:00
78d4618dfa nsxiv: get lowest date from metadata 2024-04-05 10:50:33 +02:00
9641482295 vim: fix latex compiler to pdflatex 2024-03-13 09:26:15 +01:00
b8b5a9f45e Update to current state 2024-03-09 13:39:14 +01:00
dedfe7285e vim: autocompile Rmd to pdf if file includes flag 2024-03-07 14:09:33 +01:00
b54c2abd9c newsboat: update feeds concurrently 2024-03-05 20:49:02 +01:00
cbefbe5a5e qutebrowser: remove feed ads on video pages 2024-03-05 12:46:10 +01:00
a5c1ad6af0 qutebrowser: YT: click dismissable elements
This removes ads for Youtube Premium and also the Youtube Shorts shelf
(which is garbage anyways)
2024-03-04 09:12:00 +01:00
6892176569 ranger: gp and gp mapped to go to path in clipboard 2024-02-24 15:42:34 +01:00
dfbd109c6e zathura: correctly read in $FILE in keybindings and add movepdf 2024-02-22 16:47:04 +01:00
35d8536fcf qutebrowser: update searx 2024-02-18 16:38:10 +01:00
ba4f3a72a0 update for new gridview ads 2024-02-17 11:00:39 +01:00
4e53b56e59 ranger: preview more JS properly 2024-02-14 13:43:30 +01:00
bec8276729 add basic nsxiv scripts 2024-02-05 14:47:33 +01:00
3e1222e211 qutebrowser: remove more yt ads 2024-02-05 09:25:33 +01:00
d4073acce2 syncclouds.sh: fix password for nextcloudcmd 2024-02-03 12:11:45 +01:00
8d4aabc052 qutebrowser: remove more ads 2024-02-01 11:26:55 +01:00
5f0fe257aa move to application token 2024-02-01 09:21:47 +01:00
55eac4d70c syncclouds.sh: move away from admin accoutn and to application tokens 2024-02-01 09:20:52 +01:00
18d1bca807 dmenuvpn: update to include ETH OTP 2024-01-19 14:22:04 +01:00
8e3b1e0a25 jellyfin-mpv-shim: enable jellyscrub thumbnails 2024-01-09 17:49:13 +01:00
57798d0509 jellyfing-mpv-shim: adjust settings, add to xprofile autostart 2024-01-09 07:28:23 +01:00
fe3404326a jellyfin-mpv-shim: initial add 2024-01-09 07:25:04 +01:00
836b776e49 mpv: use AUR sponsorblocks auto-loaded from /etc 2024-01-09 07:15:13 +01:00
c564f12891 syncclouds.sh: explain bodge 2024-01-02 13:11:07 +01:00
dc70dd5cd0 add clean calcurse-caldav config 2024-01-02 12:38:15 +01:00
c019575423 improve syncclouds with caldav env var 2024-01-02 12:37:32 +01:00
e2e1ff9536 add syncclouds.sh script 2024-01-01 16:22:03 +01:00
fb82ee6dbd remove custom UA as cloudflare prevents any usefulness. Fix editor command 2023-11-21 11:57:05 +01:00
d425fdcc8c adjust rezepte search url to reflect new site 2023-11-21 00:46:06 +01:00
64a45a3197 rename ranger_at_file, add it to mpv 2023-11-17 09:27:04 +01:00
48ca8bdc42 increase mpv cache limit to 2GiB 2023-11-13 13:23:30 +01:00
d93782c907 open dir of video file on alt+enter 2023-11-03 14:53:41 +01:00
69d50cf8f8 nvim: limit plugins to relevant file types 2023-10-31 21:43:31 +01:00
0f12ba81ba cleanup 2023-10-31 13:27:09 +01:00
861aa7fa0a do not match own process lol 2023-10-31 13:26:39 +01:00
3bfa50113c add Sponsorblocks userscript 2023-10-31 10:13:04 +01:00
619fe68f6a do not select first result and handle enter smarter 2023-10-26 16:03:53 +02:00
f4dd4f0804 add nvim config 2023-10-26 13:53:14 +02:00
9ea8d84549 notifications for newsboat in cronjobs) 2023-10-20 15:51:19 +02:00
04d096c2bc remove space 2023-10-18 19:33:25 +02:00
9f8b1987cd overwrite wifi display if ethernet connected 2023-10-17 11:36:07 +02:00
184d26c50c add forgotten userscripts 2023-10-15 14:45:32 +02:00
8cbc8a0ffa start all YT videos in theater mode 2023-10-15 14:43:53 +02:00
95d377e8d0 add brightness statusbar script 2023-10-15 14:40:12 +02:00
be9a6ac2fb force YouTube Resolution userscript 2023-10-15 11:39:43 +02:00
63 changed files with 30493 additions and 424 deletions

View File

@ -0,0 +1,77 @@
# If you want to synchronize calcurse with a CalDAV server using
# calcurse-caldav, create a new directory at $XDG_CONFIG_HOME/calcurse/caldav/
# (~/.config/calcurse/caldav/) and $XDG_DATA_HOME/calcurse/caldav/
# (~/.local/share/calcurse/caldav/) and copy this file to
# $XDG_CONFIG_HOME/calcurse/caldav/config and adjust the configuration below.
# Alternatively, if using ~/.calcurse, create a new directory at
# ~/.calcurse/caldav/ and copy this file to ~/.calcurse/caldav/config and adjust
# the configuration file below.
[General]
# Path to the calcurse binary that is used for importing/exporting items.
Binary = calcurse
# Host name of the server that hosts CalDAV. Do NOT prepend a protocol prefix,
# such as http:// or https://. Append :<port> for a port other than 80.
Hostname = cloud.bocken.org
# Path to the CalDAV calendar on the host specified above. This is the base
# path following your host name in the URL.
Path = /remote.php/dav/calendars/alexander/personal/
# Type of authentication to use. Must be "basic" or "oauth2"
AuthMethod = basic
# Enable this if you want to skip SSL certificate checks.
InsecureSSL = No
# Disable this if you want to use HTTP instead of HTTPS.
# Using plain HTTP is highly discouraged.
HTTPS = Yes
# This option allows you to filter the types of tasks synced. To this end, the
# value of this option should be a comma-separated list of item types, where
# each item type is either "event", "apt", "recur-event", "recur-apt", "todo",
# "recur" or "cal". Note that the comma-separated list must not contain any
# spaces. Refer to the documentation of the --filter-type command line argument
# of calcurse for more details. Set this option to "cal" if the configured
# CalDAV server doesn't support tasks, such as is the case with Google
# Calendar.
#SyncFilter = cal,todo
SyncFilter = cal
# Disable this option to actually enable synchronization. If it is enabled,
# nothing is actually written to the server or to the local data files. If you
# combine DryRun = Yes with Verbose = Yes, you get a log of what would have
# happened with this option disabled.
DryRun = No
# Enable this if you want detailed logs written to stdout.
Verbose = Yes
# Credentials for HTTP Basic Authentication (if required).
# Set `Password` to your password in plaintext (unsafe),
# or `PasswordCommand` to a shell command that retrieves it (recommended).
[Auth]
Username = alexander
# Password = # SET VIA CALCURSE_CALDAV_PASSWORD environment variable
# PasswordCommand = #Does not work
# Optionally specify additional HTTP headers here.
#[CustomHeaders]
#User-Agent = Mac_OS_X/10.9.2 (13C64) CalendarAgent/176
# Use the following to synchronize with an OAuth2-based service
# such as Google Calendar.
[OAuth2]
ClientID = calcurse
ClientSecret =
#ClientID = your_client_id
#ClientSecret = your_client_secret
# Scope of access for API calls. Synchronization requires read/write.
Scope =
# Change the redirect URI if you receive errors, but ensure that it is identical
# to the redirect URI you specified in the API settings.
RedirectURI = http://127.0.0.1

View File

@ -27,13 +27,13 @@
width = 300
# The maximum height of a single notification, excluding the frame.
height = 300
height = (0, 300)
# Position the notification in the top right corner
origin = top-right
# Offset from the origin
offset = 0x26
offset = (0, 26)
# Scale factor. It is auto-detected if value is 0.
scale = 0
@ -206,7 +206,7 @@
# icon_theme = "Adwaita, breeze"
# Align icons left/right/top/off
icon_position = left
icon_position = off
# Scale small icons up to this size, set to 0 to disable. Helpful
# for e.g. small files or high-dpi screens. In case of conflict,

View File

@ -31,7 +31,7 @@
<alias>
<family>monospace</family>
<prefer>
<family>Noto Sans Mono</family>
<family>Inconsolata</family>
<family>Libertinus Mono</family>
<family>FontAwesome</family>
<family>Braille</family>

View File

@ -0,0 +1,107 @@
{
"allow_transcode_to_h265": false,
"always_transcode": false,
"audio_output": "hdmi",
"auto_play": true,
"check_updates": false,
"client_uuid": "8aa8f850-873d-495a-ad1d-a4f2dec05e41",
"connect_retry_mins": 0,
"direct_paths": false,
"discord_presence": false,
"display_mirroring": false,
"enable_gui": true,
"enable_osc": true,
"force_audio_codec": null,
"force_set_played": false,
"force_video_codec": null,
"fullscreen": false,
"health_check_interval": 300,
"idle_cmd": null,
"idle_cmd_delay": 60,
"idle_ended_cmd": null,
"idle_when_paused": false,
"ignore_ssl_cert": false,
"kb_debug": "~",
"kb_fullscreen": "f",
"kb_kill_shader": "k",
"kb_menu": "c",
"kb_menu_down": "down",
"kb_menu_esc": "esc",
"kb_menu_left": "left",
"kb_menu_ok": "enter",
"kb_menu_right": "right",
"kb_menu_up": "up",
"kb_next": ">",
"kb_pause": "space",
"kb_prev": "<",
"kb_stop": "q",
"kb_unwatched": "u",
"kb_watched": "w",
"lang": null,
"lang_filter": "und,eng,jpn,mis,mul,zxx",
"lang_filter_audio": false,
"lang_filter_sub": false,
"local_kbps": 2147483,
"log_decisions": false,
"media_ended_cmd": null,
"media_key_seek": false,
"media_keys": true,
"menu_mouse": true,
"mpv_ext": false,
"mpv_ext_ipc": null,
"mpv_ext_no_ovr": false,
"mpv_ext_path": null,
"mpv_ext_start": true,
"mpv_log_level": "info",
"notify_updates": true,
"play_cmd": null,
"playback_timeout": 30,
"player_name": "t14",
"pre_media_cmd": null,
"prefer_transcode_to_h265": false,
"raise_mpv": true,
"remote_direct_paths": false,
"remote_kbps": 10000,
"sanitize_output": true,
"screenshot_dir": null,
"screenshot_menu": true,
"seek_down": -60,
"seek_h_exact": false,
"seek_left": -5,
"seek_right": 5,
"seek_up": 60,
"seek_v_exact": false,
"shader_pack_custom": false,
"shader_pack_enable": true,
"shader_pack_profile": null,
"shader_pack_remember": true,
"shader_pack_subtype": "lq",
"skip_intro_always": false,
"skip_intro_prompt": false,
"stop_cmd": null,
"stop_idle": false,
"subtitle_color": "#FFFFFFFF",
"subtitle_position": "bottom",
"subtitle_size": 100,
"svp_enable": false,
"svp_socket": null,
"svp_url": "http://127.0.0.1:9901/",
"sync_attempts": 5,
"sync_max_delay_skip": 300,
"sync_max_delay_speed": 50,
"sync_method_thresh": 2000,
"sync_osd_message": true,
"sync_revert_seek": true,
"sync_speed_attempts": 3,
"sync_speed_time": 1000,
"thumbnail_enable": true,
"thumbnail_jellyscrub": true,
"thumbnail_osc_builtin": true,
"thumbnail_preferred_size": 320,
"transcode_dolby_vision": true,
"transcode_hdr": false,
"transcode_hi10p": false,
"transcode_warning": true,
"use_web_seek": false,
"write_logs": false
}

124
.config/mbsync/config Normal file
View File

@ -0,0 +1,124 @@
IMAPStore alexander@bocken.org-remote
Host mail.bocken.org
Port 993
User alexander
PassCmd "pass alexander@bocken.org"
AuthMechs LOGIN
TLSType IMAPS
CertificateFile /etc/ssl/certs/ca-certificates.crt
MaildirStore alexander@bocken.org-local
Subfolders Verbatim
Path /home/alex/.local/share/mail/alexander@bocken.org/
Inbox /home/alex/.local/share/mail/alexander@bocken.org/INBOX
Channel alexander@bocken.org
Expunge Both
Far :alexander@bocken.org-remote:
Near :alexander@bocken.org-local:
Patterns * !"[Gmail]/All Mail"
Create Both
SyncState *
MaxMessages 0
ExpireUnread no
# End profile
IMAPStore abocken@ethz.ch-remote
Host outlook.office365.com
Port 993
User abocken@ethz.ch
PassCmd "mutt_oauth2.py ~/.local/share/mail/eth.token"
AuthMechs XOAUTH2
TLSType IMAPS
CertificateFile /etc/ssl/certs/ca-certificates.crt
MaildirStore abocken@ethz.ch-local
Subfolders Verbatim
Path /home/alex/.local/share/mail/abocken@ethz.ch/
Inbox /home/alex/.local/share/mail/abocken@ethz.ch/INBOX
Channel abocken@ethz.ch
Expunge Both
Far :abocken@ethz.ch-remote:
Near :abocken@ethz.ch-local:
Patterns * !"[Gmail]/All Mail"
Create Both
SyncState *
MaxMessages 0
ExpireUnread no
# End profile
#IMAPStore abocken@ethz.ch-remote
#Host mail.ethz.ch
#Port 993
#User abocken
#PassCmd "pass 'ETH/nETHz - abocken@ethz.ch'"
#AuthMechs LOGIN
#TLSType IMAPS
#CertificateFile /etc/ssl/certs/ca-certificates.crt
#
#MaildirStore abocken@ethz.ch-local
#Subfolders Verbatim
#Path /home/alex/.local/share/mail/abocken@ethz.ch/
#Inbox /home/alex/.local/share/mail/abocken@ethz.ch/INBOX
#
#Channel abocken@ethz.ch
#Expunge Both
#Far :abocken@ethz.ch-remote:
#Near :abocken@ethz.ch-local:
#Patterns * !"[Gmail]/All Mail"
#Create Both
#SyncState *
#MaxMessages 0
#ExpireUnread no
IMAPStore alexander@aaathats3as.com-remote
Host mail.cock.li
Port 993
User alexander@aaathats3as.com
PassCmd "pass eMail/aaathats3as.com"
AuthMechs LOGIN
TLSType IMAPS
CertificateFile /etc/ssl/certs/ca-certificates.crt
MaildirStore alexander@aaathats3as.com-local
Subfolders Verbatim
Path /home/alex/.local/share/mail/alexander@aaathats3as.com/
Inbox /home/alex/.local/share/mail/alexander@aaathats3as.com/INBOX
Channel alexander@aaathats3as.com
Expunge Both
Far :alexander@aaathats3as.com-remote:
Near :alexander@aaathats3as.com-local:
Patterns * !"[Gmail]/All Mail"
Create Both
SyncState *
MaxMessages 0
ExpireUnread no
# End profile
IMAPStore account@bocken.org-remote
Host mail.bocken.org
Port 993
User account
PassCmd "pass account@bocken.org"
AuthMechs LOGIN
TLSType IMAPS
CertificateFile /etc/ssl/certs/ca-certificates.crt
MaildirStore account@bocken.org-local
Subfolders Verbatim
Path /home/alex/.local/share/mail/account@bocken.org/
Inbox /home/alex/.local/share/mail/account@bocken.org/INBOX
Channel account@bocken.org
Expunge Both
Far :account@bocken.org-remote:
Near :account@bocken.org-local:
Patterns * !"[Gmail]/All Mail" !"*fts-flatcurve*" !"*virtual*"
Create Both
SyncState *
MaxMessages 0
ExpireUnread no
# End profile

View File

@ -18,3 +18,4 @@ video/x-matroska=video.desktop
video/mp4=video.desktop
x-scheme-handler/lbry=lbry.desktop
inode/directory=file.desktop
x-scheme-handler/msteams=teams.desktop

View File

@ -1,5 +1,6 @@
music_directory "~/msc"
playlist_directory "~/.config/mpd/playlists"
state_file "~/.local/share/mpd/state"
auto_update "yes"
bind_to_address "127.0.0.1"

View File

@ -6,7 +6,7 @@
# Copy this file and uncomment and edit the bindings you want to change.
#
# List of commands and further details: DOCS/man/input.rst
# List of special keys: --input-keylist
# Liut of special keys: --input-keylist
# Keybindings testing mode: mpv --input-test --force-window --idle
#
# Use 'ignore' to unbind a key fully (e.g. 'ctrl+a ignore').
@ -63,6 +63,7 @@ j no-osd seek -5 exact # seek exactly 5 seconds backward
#Alt+down add video-pan-y -0.1 # move the video up
Alt++ add video-zoom 0.1 # zoom in
Alt+- add video-zoom -0.1 # zoom out
Alt+ENTER run "openfilebrowser" "${=path}"
#Alt+BS set video-zoom 0 ; set video-pan-x 0 ; set video-pan-y 0 # reset zoom and pan settings
#PGUP add chapter 1 # seek to the next chapter
#PGDWN add chapter -1 # seek to the previous chapter

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

@ -0,0 +1 @@
demuxer-max-bytes=2000000KiB

View File

@ -0,0 +1,80 @@
-- Define the time window for keypresses
local time_window = 2 -- seconds
-- Variables to keep track of 'y' keypress and the timer
local y_pressed = false
local y_timer = nil
-- Function to reset the 'y' keypress state
local function reset_y()
y_pressed = false
if y_timer then
mp.cancel_timer(y_timer)
y_timer = nil
end
end
-- Function to handle 'y' keypress
local function handle_yanker()
reset_y()
y_pressed = true
-- Start a timer to reset the state after 2 seconds
y_timer = mp.add_timeout(time_window, reset_y)
end
-- Function to handle 'n' keypress
-- Copy the filename to clipboard
local function handle_filename()
if y_pressed then
local filename = mp.get_property("filename")
-- Use a method to copy 'filename' to clipboard (platform-specific)
-- For example, on Unix-like systems, you might use 'xclip'
os.execute("printf %s" .. filename .. " | xclip -selection clipboard")
mp.osd_message("Copied filename " .. filename .. " to clipboard", 3)
reset_y() -- Reset the 'y' keypress state
end
end
-- Bind the keys to their respective functions
-- Function to handle 'd' keypress
-- Copy the directory to clipboard
local function handle_dir()
if y_pressed then
local filepath = mp.get_property("path")
local directory = string.match(filepath, "(.*/)")
os.execute("printf %s" .. directory .. " | xclip -selection clipboard")
mp.osd_message("Copied directory " .. directory .. " to clipboard", 3)
reset_y()
end
end
-- Function to handle 'p' keypress
local function handle_path()
if y_pressed then
local full_path = mp.get_property("path")
os.execute("printf %s " .. full_path .. " | xclip -selection clipboard")
mp.osd_message("Copied full path " .. full_path .. " to clipboard", 3)
reset_y()
end
end
-- Function to copy the title to clipboard
local function handle_title()
if y_pressed then
local title = mp.get_property("media-title")
if title and title ~= mp.get_property("filename") then
os.execute("printf %s" .. title .. " | xclip -selection clipboard")
mp.osd_message("Copied title " .. title .. " to clipboard", 3)
else
handle_filename() -- Call the function to copy the filename
end
reset_y()
end
end
mp.add_key_binding("y", "check_y", handle_yanker)
mp.add_key_binding("n", "check_n", handle_filename)
mp.add_key_binding("p", "check_p", handle_path)
mp.add_key_binding("d", "check_d", handle_dir)
mp.add_key_binding("t", "check_t", handle_title)

View File

@ -0,0 +1,30 @@
-- mpv script to mark videos
local utils = require 'mp.utils'
local marked_videos = {}
local marked_file = "marked"
function toggle_mark()
local path = mp.get_property("path")
if marked_videos[path] then
marked_videos[path] = nil
mp.osd_message("Unmarked: " .. path)
else
marked_videos[path] = true
mp.osd_message("Marked: " .. path)
end
end
function save_marks()
-- Do not write anything if "marked_videos" is empty
if next(marked_videos) == nil then
return
end
local file = io.open(marked_file, "a")
for path, _ in pairs(marked_videos) do
file:write(path .. "\n")
end
file:close()
end
mp.add_key_binding("M", "toggle_mark", toggle_mark)
mp.register_event("shutdown", save_marks)

View File

@ -1 +0,0 @@
/usr/lib/mpv/sponsorblock-minimal.lua

View File

@ -1,47 +0,0 @@
# vim: filetype=neomuttrc
# muttrc file for account abocken@ethz.ch
set realname = "Alexander Bocken"
set from = "abocken@ethz.ch"
set sendmail = "msmtp -a abocken@ethz.ch"
alias me Alexander Bocken <abocken@ethz.ch>
set folder = "/home/alex/.local/share/mail/abocken@ethz.ch"
set header_cache = /home/alex/.cache/mutt-wizard/abocken@ethz.ch/headers
set message_cachedir = /home/alex/.cache/mutt-wizard/abocken@ethz.ch/bodies
set mbox_type = Maildir
bind index,pager gg noop
bind index,pager g noop
bind index,pager M noop
bind index,pager C noop
bind index gg first-entry
unmailboxes *
unalternates *
unset signature
unmacro index o
macro index o "<shell-escape>mailsync abocken@ethz.ch<enter>" "run mbsync to sync abocken@ethz.ch"
mailboxes "=Calendar" "=Deleted Items" "=Drafts" "=INBOX" "=Journal" "=Junk E-Mail" "=Notes" "=Outbox" "=Sent" "=Sent Items" "=Tasks" "=Trash"
set postponed = "+Drafts"
macro index,pager gd "<change-folder>=Drafts<enter>" "go to drafts"
macro index,pager Md ";<save-message>=Drafts<enter>" "move mail to drafts"
macro index,pager Cd ";<copy-message>=Drafts<enter>" "copy mail to drafts"
macro index,pager gi "<change-folder>=INBOX<enter>" "go to inbox"
macro index,pager Mi ";<save-message>=INBOX<enter>" "move mail to inbox"
macro index,pager Ci ";<copy-message>=INBOX<enter>" "copy mail to inbox"
set spoolfile = "+INBOX"
macro index,pager gj "<change-folder>=Junk<enter>" "go to junk"
macro index,pager Mj ";<save-message>=Junk<enter>" "move mail to junk"
macro index,pager Cj ";<copy-message>=Junk<enter>" "copy mail to junk"
set record = "+Sent"
macro index,pager gs "<change-folder>=Sent<enter>" "go to sent"
macro index,pager Ms ";<save-message>=Sent<enter>" "move mail to sent"
macro index,pager Cs ";<copy-message>=Sent<enter>" "copy mail to sent"
set record = "+Sent"
macro index,pager gs "<change-folder>=Sent<enter>" "go to sent"
macro index,pager Ms ";<save-message>=Sent<enter>" "move mail to sent"
macro index,pager Cs ";<copy-message>=Sent<enter>" "copy mail to sent"
macro index,pager gt "<change-folder>=Trash<enter>" "go to trash"
macro index,pager Mt ";<save-message>=Trash<enter>" "move mail to trash"
macro index,pager Ct ";<copy-message>=Trash<enter>" "copy mail to trash"
set trash = "+Trash"

View File

@ -5,18 +5,15 @@ set from = "alexander@bocken.org"
set sendmail = "msmtp -a alexander@bocken.org"
alias me Alexander Bocken <alexander@bocken.org>
set folder = "/home/alex/.local/share/mail/alexander@bocken.org"
set header_cache = /home/alex/.cache/mutt-wizard/alexander@bocken.org/headers
set message_cachedir = /home/alex/.cache/mutt-wizard/alexander@bocken.org/bodies
set header_cache = "/home/alex/.cache/mutt-wizard/alexander_bocken.org/headers"
set message_cachedir = "/home/alex/.cache/mutt-wizard/alexander_bocken.org/bodies"
set mbox_type = Maildir
set hostname = "bocken.org"
#source /usr/share/mutt-wizard/switch.muttrc
set spoolfile = +INBOX
set postponed = +Drafts
set trash = +Trash
set record = +Sent
source /usr/share/mutt-wizard/switch.muttrc
set spoolfile = "+INBOX"
set postponed = "+Drafts"
set trash = "+Trash"
set record = "+Sent"
macro index o "<shell-escape>mailsync alexander@bocken.org<enter>" "run mbsync to sync alexander@bocken.org"
macro index \eg "<enter-command>unset wait_key<enter><shell-escape>gpg --list-secret-keys; printf 'Enter email ID of user to publish: '; read eID; printf 'Enter fingerprint of GPG key to publish: '; read eFGPT; /usr/lib/gnupg/gpg-wks-client --create \$eFGPT \$eID | msmtp --read-envelope-from --read-recipients -a alexander@bocken.org<enter>" "publish GPG key to WKS provider"
macro index \eh "<pipe-message>/usr/lib/gnupg/gpg-wks-client --receive | msmtp --read-envelope-from --read-recipients -a alexander@bocken.org<enter>" "confirm GPG publication"
mailboxes "=Archive/Archive" "=Trash/Trash" "=Sent" "=Junk" "=Drafts" "=INBOX"
macro index o "<shell-escape>mailsync alexander@bocken.org<enter>" "sync alexander@bocken.org"
mailboxes "=Sent" "=Junk" "=Drafts" "=INBOX"

View File

@ -1,8 +1,7 @@
# vim: filetype=neomuttrc
source /usr/share/mutt-wizard/mutt-wizard.muttrc
source /home/alex/.config/mutt/accounts/alexander@bocken.org.muttrc
macro index,pager i1 '<sync-mailbox><enter-command>source /home/alex/.config/mutt/accounts/alexander@bocken.org.muttrc<enter><change-folder>!<enter>;<check-stats>' "switch to alexander@bocken.org"
macro index,pager i2 '<sync-mailbox><enter-command>source /home/alex/.config/mutt/accounts/1-abocken@ethz.ch.muttrc<enter><change-folder>!<enter>;<check-stats>' "switch to abocken@ethz.ch"
macro index,pager i2 '<sync-mailbox><enter-command>source /home/alex/.config/mutt/accounts/abocken@ethz.ch.muttrc<enter><change-folder>!<enter>;<check-stats>' "switch to abocken@ethz.ch"
set forward_attachments = ask-yes
macro compose m \
"<enter-command>set pipe_decode<enter>\
@ -14,6 +13,17 @@ macro compose m \
<tag-entry><previous-entry><tag-entry><group-alternatives>" \
"Convert markdown to HTML5 and plaintext alternative content types"
set query_command = "abook --config $XDG_CONFIG_HOME/abook/abookrc --datafile $XDG_DATA_HOME/abook/addressbook --mutt-query '%s'"
macro index,pager a "<enter-command>set my_pipe_decode=\$pipe_decode pipe_decode<return><pipe-message>abook --config $XDG_CONFIG_HOME/abook/abookrc --datafile $XDG_DATA_HOME/abook/addressbook --add-email<return><enter-command>set pipe_decode=\$my_pipe_decode; unset my_pipe_decode<return>" "add the sender address to abook"
#set query_command = "abook --config $XDG_CONFIG_HOME/abook/abookrc --datafile $XDG_DATA_HOME/abook/addressbook --mutt-query '%s'"
#macro index,pager a "<enter-command>set my_pipe_decode=\$pipe_decode pipe_decode<return><pipe-message>abook --config $XDG_CONFIG_HOME/abook/abookrc --datafile $XDG_DATA_HOME/abook/addressbook --add-email<return><enter-command>set pipe_decode=\$my_pipe_decode; unset my_pipe_decode<return>" "add the sender address to abook"
macro index,pager i3 '<sync-mailbox><enter-command>source /home/alex/.config/mutt/accounts/alexander@aaathats3as.com.muttrc<enter><change-folder>!<enter>;<check-stats>' "switch to alexander@aaathats3as.com"
macro index,pager i1 '<sync-mailbox><enter-command>source /home/alex/.config/mutt/accounts/alexander@bocken.org.muttrc<enter><change-folder>!<enter>;<check-stats>' "switch to alexander@bocken.org"
set query_command= "mates mutt-query '%s'"
set query_command = "echo %s | xargs khard email --parsable --"
bind editor <Tab> complete-query
bind editor ^T complete
macro index,pager a \
"<pipe-message>khard add-email<return>" \
"add the sender email address to khard"

View File

@ -1,5 +1,6 @@
#show-read-feeds no
auto-reload yes
reload-threads 100
external-url-viewer "urlscan -dc -r 'linkhandler {}'"

23
.config/nsxiv/exec/image-info Executable file
View File

@ -0,0 +1,23 @@
#!/bin/sh
# Example for $XDG_CONFIG_HOME/nsxiv/exec/image-info
# Called by nsxiv(1) whenever an image gets loaded.
# The output is displayed in nsxiv's status bar.
# Arguments:
# $1: path to image file (as provided by the user)
# $2: image width
# $3: image height
# $4: fully resolved path to the image file
s=" " # field separator
exec 2>/dev/null
filename=$(basename -- "$1")
filesize=$(du -Hh -- "$1" | cut -f 1)
geometry="${2}x${3}"
#TODO: imrpove for multiple date formats
#currently just picks the first date that is not a profile or file date using exiftool (no one coherent standard for date in exif metadata is used)
date_shot="$(exiftool -- "$1" | grep 'Date' | grep -vE '(Profile|File)' | cut -d: -f1 --complement | sort | head -n1)"
echo "${filesize}${s}${geometry}${s}${filename}${s}${date_shot}"

View File

@ -26,7 +26,7 @@ do
readlink -f "$file" | tr -d '\n' | xclip -selection clipboard &&
notify-send "$(readlink -f "$file") copied to clipboard" & ;;
"d")
[ "$(printf "No\\nYes" | dmenu -i -p "Really delete $file?")" = "Yes" ] && rm "$file" && notify-send "$file deleted." ;;
[ "$(printf "No\\nYes" | dmenu -n -i -p "Really delete $file?")" = "Yes" ] && rm "$file" && notify-send "$file deleted." ;;
"g") ifinstalled gimp && setsid -f gimp "$file" ;;
"i") notify-send "File information" "$(mediainfo "$file")" ;;
esac

20
.config/nsxiv/exec/thumb-info Executable file
View File

@ -0,0 +1,20 @@
#!/bin/sh
# Example for $XDG_CONFIG_HOME/nsxiv/exec/thumb-info
# Called by nsxiv(1) whenever the selected thumbnail changes.
# The output is displayed in nsxiv's status bar.
# Arguments:
# $1: path to image file (as provided by the user)
# $2: empty
# $3: empty
# $4: fully resolved path to the image file
s=" " # field separator
exec 2>/dev/null
filename=$(basename -- "$4")
filesize=$(du -Hh -- "$4" | cut -f 1)
echo "${filesize}${s}${filename}"

27
.config/nsxiv/exec/win-title Executable file
View File

@ -0,0 +1,27 @@
#!/bin/sh
# Example for $XDG_CONFIG_HOME/nsxiv/exec/win-title
# Called by nsxiv(1) whenever any of the relevant information changes.
# The output is set as nsxiv's window title.
#
# Arguments, "Optional" arguments might be empty:
# $1: resolved absolute path of the current file
# $2: current file number
# $3: total file number
# $4: image width (Optional: Disabled on thumbnails mode)
# $5: image height (Optional: Disabled on thumbnails mode)
# $6: current zoom (Optional: Disabled on thumbnails mode)
#
# The term file is used rather than image as nsxiv does not
# precheck that the input files are valid images. Total file
# count may be different from the actual count of valid images.
exec 2>/dev/null
filename="${1##*/}"
if [ -n "$4" ]; then # image mode
printf "%s" "nsxiv - ${filename} | ${4}x${5} ${6}% [${2}/${3}]"
else
printf "%s" "nsxiv - ${filename} [${2}/${3}]"
fi

View File

@ -0,0 +1,6 @@
{
"suggest.enablePreselect": false,
"suggest.noselect": true,
"svelte.enable-ts-plugin": true,
"pyright.inlayHints.variableTypes": false
}

628
.config/nvim/init.vim Normal file
View File

@ -0,0 +1,628 @@
let mapleader =","
let g:vimwiki_list = [{'path': '~/dox/notes/', 'index': 'Main'}]
if ! filereadable(system('echo -n "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/plug.vim"'))
echo "Downloading junegunn/vim-plug to manage plugins..."
silent !mkdir -p ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/
silent !curl "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" > ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/plug.vim
autocmd VimEnter * PlugInstall
endif
let g:vimwiki_list = [{'path': '~/dox/notes/', 'index': 'Main'}]
call plug#begin(system('echo -n "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/plugged"'))
Plug 'tpope/vim-surround'
Plug 'preservim/nerdtree'
Plug 'junegunn/goyo.vim'
Plug 'jreybert/vimagit'
Plug 'lukesmithxyz/vimling'
Plug 'vimwiki/vimwiki'
Plug 'vim-airline/vim-airline'
Plug 'tpope/vim-commentary'
Plug 'neoclide/coc.nvim', {'branch': 'master', 'do': 'yarn install --frozen-lockfile'}
Plug 'ap/vim-css-color'
Plug 'lervag/vimtex', { 'for': ['tex'] }
Plug 'arcticicestudio/nord-vim'
Plug 'rhysd/vim-grammarous'
Plug 'jalvesaq/Nvim-R', {'branch': 'stable', 'for': ['r', 'R', 'Rmd', 'rmd']}
Plug 'luk400/vim-jukit'
Plug 'David-Kunz/gen.nvim'
Plug 'othree/html5.vim'
Plug 'pangloss/vim-javascript'
Plug 'evanleck/vim-svelte', {'branch': 'main'}
Plug 'github/copilot.vim',
Plug 'nathangrigg/vim-beancount'
call plug#end()
let g:vimwiki_list = [{'path': '~/dox/notes/', 'index': 'Main'}]
set title
set bg=light
set go=a
set mouse=a
set nohlsearch
set clipboard+=unnamedplus
set noshowmode
set noruler
set laststatus=0
set noshowcmd
set undofile
colorscheme nord
" Some basics:
nnoremap c "_c
set nocompatible
filetype plugin on
syntax on
set encoding=utf-8
set number relativenumber
" respects camel case as different words
set iskeyword-=_
" Enable autocompletion:
set wildmode=longest,list,full
" Disables automatic commenting on newline:
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
" Perform dot commands over visual blocks:
vnoremap . :normal .<CR>
" Goyo plugin makes text more readable when writing prose:
map <leader>f :Goyo \| set bg=light \| set linebreak<CR>
" Spell-check set to <leader>o, 'o' for 'orthography':
map <leader>o :setlocal spell! spelllang=en_us<CR>
" Splits open at the bottom and right, which is non-retarded, unlike vim defaults.
set splitbelow splitright
""" Autocompile RMarkdown on save if flag is set in file
" Define a function to check for the autocompile flag and compile if present
function! CompileRMarkdown()
let autocompile = search('<\!--\s\+vim:\s\+set\s\+autocompile=true\s\+-->', 'nW') != 0
if autocompile
silent !Rscript -e 'rmarkdown::render("%")'
redraw!
endif
endfunction
" Automatically compile RMarkdown on buffer write
autocmd BufWritePost *.Rmd call CompileRMarkdown()
""" GitHub Copilot
" remap accept to <C-J> instead of <CR>
imap <silent><script><expr> <C-J> copilot#Accept("\<CR>")
let g:copilot_no_tab_map = v:true
" Python Notebooks using jukit
let g:_jukit_python_os_cmd = 'python'
let g:jukit_shell_cmd = 'ipython'
" - Specifies the command used to start a shell in the output split. Can also be an absolute path. Can also be any other shell command, e.g. `R`, `julia`, etc. (note that output saving is only possible for ipython)
let g:jukit_terminal = 'nvimterm'
" - Terminal to use. Can be one of '', 'kitty', 'vimterm', 'nvimterm' or 'tmux'. If '' is given then will try to detect terminal (though this might fail, in which case it simply defaults to 'vimterm' or 'nvimterm' - depending on the output of `has("nvim")`)
let g:jukit_auto_output_hist = 0
" - If set to 1, will create an autocmd with event `CursorHold` to show saved ipython output of current cell in output-history split. Might slow down (n)vim significantly, you can use `set updatetime=<number of milliseconds>` to control the time to wait until CursorHold events are triggered, which might improve performance if set to a higher number (e.g. `set updatetime=1000`).
let g:jukit_use_tcomment = 0
" - Whether to use tcomment plugin (https://github.com/tomtom/tcomment_vim) to comment out cell markers. If not, then cell markers will simply be prepended with `g:jukit_comment_mark`
let g:jukit_comment_mark = '#'
" - See description of `g:jukit_use_tcomment` above
let g:jukit_mappings = 1
" - If set to 0, none of the default function mappings (as specified further down) will be applied
let g:jukit_mappings_ext_enabled = "*"
" - String or list of strings specifying extensions for which the mappings will be created. For example, `let g:jukit_mappings_ext_enabled=['py', 'ipynb']` will enable the mappings only in `.py` and `.ipynb` files. Use `let g:jukit_mappings_ext_enabled='*'` to enable them for all files.
let g:jukit_highlight_markers = 1
" - Whether to highlight cell markers or not. You can specify the colors of cell markers by putting e.g. `highlight jukit_cellmarker_colors guifg=#1d615a guibg=#1d615a ctermbg=22 ctermfg=22` with your desired colors in your (neo)vim config. Make sure to define this highlight *after* loading a colorscheme in your (neo)vim config
let g:jukit_enable_textcell_bg_hl = 0
let g:jukit_textcell_bg_colors_guibg='#888888'
let g:jukit_textcell_bg_colors_ctermbg='#ffffff'
" - Whether to highlight background of textcells. You can specify the color by putting `highlight jukit_textcell_bg_colors guibg=#131628 ctermbg=0` with your desired colors in your (neo)vim config. Make sure to define this highlight group *after* loading a colorscheme in your (neo)vim config.
let g:jukit_enable_textcell_syntax = 1
" - Whether to enable markdown syntax highlighting in textcells
let g:jukit_text_syntax_file = $VIMRUNTIME . '/syntax/' . 'markdown.vim'
" - Syntax file to use for textcells. If you want to define your own syntax matches inside of text cells, make sure to include `containedin=textcell`.
let g:jukit_hl_ext_enabled = '*'
" - String or list of strings specifying extensions for which the relevant highlighting autocmds regarding marker-highlighting, textcell-highlighting, etc. will be created. For example, `let g:jukit_hl_extensions=['py', 'R']` will enable the defined highlighting options for `.py` and `.R` files. Use `let g:jukit_hl_extensions='*'` to enable them for all files and `let g:jukit_hl_extensions=''` to disable them completely
let g:jukit_convert_overwrite_default = -1
" - Default setting when converting from .ipynb to .py or vice versa and a file of the same name already exists. Can be of [-1, 0, 1], where -1 means no default (i.e. you'll be prompted to specify what to do), 0 means never overwrite, 1 means always overwrite
let g:jukit_convert_open_default = -1
let g:jukit_hist_use_ueberzug = 0
" - Set to 1 to use Überzug to display saved outputs instead of an ipython split window
let g:jukit_ueberzug_use_cached = 1
" - Whether to cache created images of saved outputs. If set to 0, will convert saved outputs to png from scratch each time. Note that this will make displaying saved outputs significantly slower.
let g:jukit_ueberzug_pos = [0.25, 0.25, 0.4, 0.6]
" - position and dimension of Überzug window WITH output split present - [x, y, width, height]. Use `:call jukit#ueberzug#set_default_pos()` to modify/visualize.
let g:jukit_ueberzug_pos_noout = [0.25, 0.25, 0.4, 0.6]
" - position and dimension of Überzug window WITHOUT output split present - [x, y, width, height]. Use `:call jukit#ueberzug#set_default_pos()` to modify/visualize.
let g:jukit_kill_ueberzug_on_focus_lost = 1
" - whether to kill ueberzug when the focus to neovim is lost (detecting focus might only work on neovim). if set to 0, the ueberzug image keeps being displayed even when neovim loses focus (e.g. when switching tabs in terminal).
let g:jukit_ueberzug_border_color = get(g:, 'jukit_ueberzug_border_color', 'blue')
" - border color of Überzug images
let g:jukit_ueberzug_theme = 'dark'
" - choose dark or light theme for markdown cells
let g:jukit_ueberzug_term_hw_ratio = -1
" - this is relevant in case the shown ueberzug image is cut off horizontally. In that case, the determined width/height ratio of your terminal cells is determined incorrectly. A value of -1 means the ratio should be determined automatically. A ratio of 2.2 is used by default if the ratio can't be determined automatically. If you get a cut off image, try setting this parameter and vary the values around 2.0 (e.g. `let g:jukit_ueberzug_term_hw_ratio = 2.3` or `let g:jukit_ueberzug_term_hw_ratio = 1.9`) until the image is displayed correctly to determine your needed ratio.
let g:jukit_ueberzug_python_cmd = 'python3'
" - path to python3 executable for which the überzug requirements (beautifulsoup4, pillow, ueberzug) are installed. By default it just uses the python3 command found in your environment. If you started an output split in a virtual environment, make sure that you either have all the requirements in the virtual requirements or set the absolute path to the python3 command.
let g:jukit_ueberzug_jupyter_cmd = 'jupyter'
" - path to jupyter executable. By default it just uses the jupyter command found in your environment. If you started an output split in a virtual environment, make sure that you either have jupyter installed in that environment or set the absolute path to the python3 command.
let g:jukit_ueberzug_cutycapt_cmd = 'CutyCapt'
" - path to cutycapt executable
let g:jukit_ueberzug_imagemagick_cmd = 'magick'
" - path to imagemagick (`convert` command) executable
" Nerd tree
"map <leader>n :NERDTreeToggle<CR>
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
if has('nvim')
let NERDTreeBookmarksFile = stdpath('data') . '/NERDTreeBookmarks'
else
let NERDTreeBookmarksFile = '~/.vim' . '/NERDTreeBookmarks'
endif
" Nvim-R Defintions for R IDE
let g:R_assign = 3 " do (not) map _ to <- for assignment
vmap <Space> <Plug>RDSendSelection
nmap <Space> <Plug>RDSendLine
let R_nvimpager = 'tab' " display R docs in new tab
let R_start_libs = 'base,stats,graphics,grDevices,utils,methods'
let R_hl_term = 0
" let Rout_more_colors = 1
"This allows for change paste motion cp{motion}
nmap <silent> cp :set opfunc=ChangePaste<CR>g@
function! ChangePaste(type, ...)
silent exe "normal! `[v`]\"_c"
silent exe "normal! p"
endfunction
" vimtex:
let g:vimtex_view_method = 'zathura'
let g:vimtex_compiler_latexmk = { 'build_dir' : '',
\ 'callback' : 1,
\ 'continuous' : 1,
\ 'executable' : 'latexmk',
\ 'hooks' : [],
\ 'options' : [
\ '-pdflatex="pdflatex --shell-escape %O %S"',
\ '-verbose',
\ '-file-line-error',
\ '-synctex=1',
\ '-interaction=nonstopmode',
\ ],
\}
"\ '-pdflatex="pdflatex --shell-escape %O %S"',
" vimling:
"nm <leader><leader>d :call ToggleDeadKeys()<CR>
"imap <leader><leader>d <esc>:call ToggleDeadKeys()<CR>a
"nm <leader><leader>i :call ToggleIPA()<CR>
"imap <leader><leader>i <esc>:call ToggleIPA()<CR>a
"nm <leader><leader>q :call ToggleProse()<CR>
" Shortcutting split navigation, saving a keypress:
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
" Replace ex mode with gq
map Q gq
" Check file in shellcheck:
map <leader>s :!clear && shellcheck -x %<CR>
" Open my bibliography file in split
map <leader>b :!( st nvim $BIB & ) > /dev/null 2>&1<CR>
map <leader>r :vsp<space>$REFER<CR>
" Replace all is aliased to S.
nnoremap S :%s//g<Left><Left>
" Compile document, be it groff/LaTeX/markdown/etc.
map <leader>c :w! \| !compiler "<c-r>%"<CR>
" Open corresponding .pdf/.html or preview
map <leader>p :!opout <c-r>%<CR><CR>
" start browser-sync for easier refresh with web-dev
nnoremap <leader>bs :!browser-sync start --server --files . > /dev/null 2>&1 &<CR>
" Runs a script that cleans out tex build files whenever I close out of a .tex file.
autocmd VimLeave *.tex !texclear %
" Ensure files are read as what I want:
let g:vimwiki_ext2syntax = {'.md': 'markdown', '.markdown': 'markdown', '.mdown': 'markdown'}
map <leader>v :VimwikiIndex
let g:vimwiki_list = [{'path': '~/vimwiki', 'syntax': 'markdown', 'ext': '.md'}]
autocmd BufRead,BufNewFile /tmp/calcurse*,~/.calcurse/notes/* set filetype=markdown
autocmd BufRead,BufNewFile *.ms,*.me,*.mom,*.man set filetype=groff
autocmd BufRead,BufNewFile *.tex set filetype=tex
" Save file as sudo on files that require root permission
cnoremap w!! execute 'silent! write !sudo tee % >/dev/null' <bar> edit!
" Enable Goyo by default for mutt writing
autocmd BufRead,BufNewFile /tmp/neomutt* let g:goyo_width=80
autocmd BufRead,BufNewFile /tmp/neomutt* :Goyo | set bg=light
autocmd BufRead,BufNewFile /tmp/neomutt* map ZZ :Goyo\|x!<CR>
autocmd BufRead,BufNewFile /tmp/neomutt* map ZQ :Goyo\|q!<CR>
" Automatically deletes all trailing whitespace and newlines at end of file on save. & reset cursor position
autocmd BufWritePre * let currPos = getpos(".")
autocmd BufWritePre * %s/\s\+$//e
autocmd BufWritePre * %s/\n\+\%$//e
autocmd BufWritePre *.[ch] %s/\%$/\r/e
autocmd BufWritePre * cal cursor(currPos[1], currPos[2])
" When shortcut files are updated, renew bash and ranger configs with new material:
autocmd BufWritePost bm-files,bm-dirs !shortcuts
" Run xrdb whenever Xdefaults or Xresources are updated.
autocmd BufRead,BufNewFile Xresources,Xdefaults,xresources,xdefaults set filetype=xdefaults
autocmd BufWritePost Xresources,Xdefaults,xresources,xdefaults !xrdb %
" Recompile dwmblocks on config edit.
autocmd BufWritePost ~/.local/src/dwmblocks/config.h !cd ~/.local/src/dwmblocks/; sudo make install && { killall -q dwmblocks;setsid -f dwmblocks }
" Navigating with guides
inoremap <leader><leader> <Esc>/<++><Enter>"_c4l
vnoremap <leader><leader> <Esc>/<++><Enter>"_c4l
map <leader><leader> <Esc>/<++><Enter>"_c4l
" Turns off highlighting on the bits of code that are changed, so the line that is changed is highlighted but the actual text that has changed stands out on the line and is readable.
if &diff
highlight! link DiffText MatchParen
endif
" Function for toggling the bottom statusbar:
let s:hidden_all = 1
function! ToggleHiddenAll()
if s:hidden_all == 0
let s:hidden_all = 1
set noshowmode
set noruler
set laststatus=0
set noshowcmd
else
let s:hidden_all = 0
set showmode
set ruler
set laststatus=2
set showcmd
endif
endfunction
nnoremap <leader>h :call ToggleHiddenAll()<CR>
"""LATEX
" Word count:
autocmd FileType tex map <leader>w :w !detex \| wc -w<CR>
" Code snippets
"""autocmd FileType tex inoremap ,fr \begin{frame}<Enter>\frametitle{}<Enter><Enter><++><Enter><Enter>\end{frame}<Enter><Enter><++><Esc>6kf}i
autocmd FileType tex inoremap ,fi \begin{fitch}<Enter><Enter>\end{fitch}<Enter><Enter><++><Esc>3kA
autocmd FileType tex inoremap ,exe \begin{exe}<Enter>\ex<Space><Enter>\end{exe}<Enter><Enter><++><Esc>3kA
autocmd FileType tex inoremap ,bf \textbf{}<++><Esc>T{i
autocmd FileType tex vnoremap , <ESC>`<i\{<ESC>`>2la}<ESC>?\\{<Enter>a
autocmd FileType tex inoremap ,it \textit{}<++><Esc>T{i
autocmd FileType tex inoremap ,ct \textcite{}<++><Esc>T{i
autocmd FileType tex inoremap ,cp \parencite{}<++><Esc>T{i
autocmd FileType tex inoremap ,glos {\gll<Space><++><Space>\\<Enter><++><Space>\\<Enter>\trans{``<++>''}}<Esc>2k2bcw
autocmd FileType tex inoremap ,x \begin{xlist}<Enter>\ex<Space><Enter>\end{xlist}<Esc>kA<Space>
autocmd FileType tex inoremap ,ol \begin{enumerate}<Enter><Enter>\end{enumerate}<Enter><Enter><++><Esc>3kA\item<Space>
autocmd FileType tex inoremap ,ul \begin{itemize}<Enter><Enter>\end{itemize}<Enter><Enter><++><Esc>3kA\item<Space>
autocmd FileType tex inoremap ,li <Enter>\item[]<Space>
autocmd FileType tex inoremap ,ref \ref{}<Space><++><Esc>T{i
autocmd FileType tex inoremap ,tab \begin{tabular}<Enter><++><Enter>\end{tabular}<Enter><Enter><++><Esc>4kA{}<Esc>i
autocmd FileType tex inoremap ,ot \begin{tableau}<Enter>\inp{<++>}<Tab>\const{<++>}<Tab><++><Enter><++><Enter>\end{tableau}<Enter><Enter><++><Esc>5kA{}<Esc>i
autocmd FileType tex inoremap ,can \cand{}<Tab><++><Esc>T{i
autocmd FileType tex inoremap ,con \const{}<Tab><++><Esc>T{i
autocmd FileType tex inoremap ,v \vio{}<Tab><++><Esc>T{i
autocmd FileType tex inoremap ,a \href{}{<++>}<Space><++><Esc>2T{i
autocmd FileType tex inoremap ,sc \textsc{}<Space><++><Esc>T{i
autocmd FileType tex inoremap ,chap \chapter{}<Enter><Enter><++><Esc>2kf}i
autocmd FileType tex inoremap ,sec \section{}<Enter><Enter><++><Esc>2kf}i
autocmd FileType tex inoremap ,ssec \subsection{}<Enter><Enter><++><Esc>2kf}i
autocmd FileType tex inoremap ,sssec \subsubsection{}<Enter><Enter><++><Esc>2kf}i
autocmd FileType tex inoremap ,st <Esc>F{i*<Esc>f}i
autocmd FileType tex inoremap ,beg \begin{DELRN}<Enter><++><Enter>\end{DELRN}<Enter><Enter><++><Esc>4k0fR:MultipleCursorsFind<Space>DELRN<Enter>c
autocmd FileType tex inoremap ,up <Esc>/usepackage<Enter>o\usepackage{}<Esc>i
autocmd FileType tex nnoremap ,up /usepackage<Enter>o\usepackage{}<Esc>i
autocmd FileType tex inoremap ,tt \texttt{}<Space><++><Esc>T{i
autocmd FileType tex inoremap ,bt {\blindtext}
autocmd FileType tex inoremap ,nu $\varnothing$
autocmd FileType tex inoremap ,col \begin{columns}[T]<Enter>\begin{column}{.5\textwidth}<Enter><Enter>\end{column}<Enter>\begin{column}{.5\textwidth}<Enter><++><Enter>\end{column}<Enter>\end{columns}<Esc>5kA
autocmd FileType tex inoremap ,rn (\ref{})<++><Esc>F}i
autocmd FileType tex inoremap ,fr \dfrac{}{<++>} <++> <Esc>T{2hi
autocmd FileType tex inoremap ,sqrt \sqrt{}<++> <Esc>T{i
autocmd FileType tex inoremap ,b( \left(\right)<++><Esc>T(i
autocmd FileType tex inoremap ,bb \mathbb{}<++><Esc>T{i
autocmd FileType tex inoremap ,b{ \left\{\right\}<++><Esc>T{i
autocmd FileType tex inoremap ,b[ \left[\right]<++><Esc>T[i
autocmd FileType tex inoremap ,rm \mathrm{}<++><Esc>T{i
autocmd FileType tex inoremap ,abs \left\|\right\|<++><Esc>3ba
autocmd FileType tex inoremap ,em \emph{}<++><Esc>T{i
autocmd FileType tex inoremap ,tabb \begin{tabbing}<Enter>\hspace*{3cm}\=\hspace*{3cm}\= \kill<Enter>\end{tabbing}<Enter><Enter><++><Esc>3kA<Enter>
autocmd FileType tex inoremap ,txt \text{}<++><Esc>T{i
autocmd FileType tex inoremap ,sfr \sfrac{}{<++>}<++><Esc>2T{i
"""HTML
autocmd FileType html inoremap ,b <b></b><Space><++><Esc>FbT>i
autocmd FileType html inoremap ,it <em></em><Space><++><Esc>FeT>i
autocmd FileType html inoremap ,1 <h1></h1><Enter><Enter><++><Esc>2kf<i
autocmd FileType html inoremap ,2 <h2></h2><Enter><Enter><++><Esc>2kf<i
autocmd FileType html inoremap ,3 <h3></h3><Enter><Enter><++><Esc>2kf<i
autocmd FileType html inoremap ,p <p></p><Enter><Enter><++><Esc>02kf>a
autocmd FileType html inoremap ,a <a<Space>href=""><++></a><Space><++><Esc>14hi
autocmd FileType html inoremap ,e <a<Space>target="_blank"<Space>href=""><++></a><Space><++><Esc>14hi
autocmd FileType html inoremap ,ul <ul><Enter><li></li><Enter></ul><Enter><Enter><++><Esc>03kf<i
autocmd FileType html inoremap ,li <Esc>o<li></li><Esc>F>a
autocmd FileType html inoremap ,ol <ol><Enter><li></li><Enter></ol><Enter><Enter><++><Esc>03kf<i
autocmd FileType html inoremap ,im <img src="" alt="<++>"><++><esc>Fcf"a
autocmd FileType html inoremap ,td <td></td><++><Esc>Fdcit
autocmd FileType html inoremap ,tr <tr></tr><Enter><++><Esc>kf<i
autocmd FileType html inoremap ,th <th></th><++><Esc>Fhcit
autocmd FileType html inoremap ,tab <table><Enter></table><Esc>O
autocmd FileType html inoremap ,gr <font color="green"></font><Esc>F>a
autocmd FileType html inoremap ,rd <font color="red"></font><Esc>F>a
autocmd FileType html inoremap ,yl <font color="yellow"></font><Esc>F>a
autocmd FileType html inoremap ,dt <dt></dt><Enter><dd><++></dd><Enter><++><esc>2kcit
autocmd FileType html inoremap ,dl <dl><Enter><Enter></dl><enter><enter><++><esc>3kcc
"autocmd FileType html inoremap &<space> &amp;<space>
autocmd FileType html inoremap ,fr <sup></sup>&frasl;<sub><++></sub><++><esc>2T/2hi
autocmd FileType html inoremap ,o<space> <i><sup></sup></i>
autocmd FileType html inoremap ,cr <i><sup></sup></i>
autocmd FileType html inoremap ,pl <p lang=la></p><esc>Taa
autocmd FileType html inoremap ,pd <p lang=de></p><esc>Tea
autocmd FileType html inoremap ,dg °C
"autocmd FileType html inoremap á &aacute;
"autocmd FileType html inoremap é &eacute;
"autocmd FileType html inoremap í &iacute;
"autocmd FileType html inoremap ó &oacute;
"autocmd FileType html inoremap ú &uacute;
"autocmd FileType html inoremap ä &auml;
"autocmd FileType html inoremap ë &euml;
"autocmd FileType html inoremap ï &iuml;
"autocmd FileType html inoremap ö &ouml;
"autocmd FileType html inoremap ü &uuml;
"autocmd FileType html inoremap ã &atilde;
"autocmd FileType html inoremap ẽ &etilde;
"autocmd FileType html inoremap ĩ &itilde;
"autocmd FileType html inoremap õ &otilde;
"autocmd FileType html inoremap ũ &utilde;
"autocmd FileType html inoremap ñ &ntilde;
"autocmd FileType html inoremap à &agrave;
"autocmd FileType html inoremap è &egrave;
"autocmd FileType html inoremap ì &igrave;
"autocmd FileType html inoremap ò &ograve;
"autocmd FileType html inoremap ù &ugrave;
""".bib
autocmd FileType bib inoremap ,a @article{<Enter>author<Space>=<Space>{<++>},<Enter>year<Space>=<Space>{<++>},<Enter>title<Space>=<Space>{<++>},<Enter>journal<Space>=<Space>{<++>},<Enter>volume<Space>=<Space>{<++>},<Enter>pages<Space>=<Space>{<++>},<Enter>}<Enter><++><Esc>8kA,<Esc>i
autocmd FileType bib inoremap ,b @book{<Enter>author<Space>=<Space>{<++>},<Enter>year<Space>=<Space>{<++>},<Enter>title<Space>=<Space>{<++>},<Enter>publisher<Space>=<Space>{<++>},<Enter>}<Enter><++><Esc>6kA,<Esc>i
autocmd FileType bib inoremap ,c @incollection{<Enter>author<Space>=<Space>{<++>},<Enter>title<Space>=<Space>{<++>},<Enter>booktitle<Space>=<Space>{<++>},<Enter>editor<Space>=<Space>{<++>},<Enter>year<Space>=<Space>{<++>},<Enter>publisher<Space>=<Space>{<++>},<Enter>}<Enter><++><Esc>8kA,<Esc>i
"MARKDOWN
autocmd Filetype markdown,rmd map <leader>w yiWi[<esc>Ea](<esc>pa)
autocmd Filetype markdown,rmd inoremap ,n ---<Enter><Enter>
autocmd Filetype markdown,rmd inoremap ,b ****<++><Esc>F*hi
autocmd Filetype markdown,rmd inoremap ,s ~~~~<++><Esc>F~hi
autocmd Filetype markdown,rmd inoremap ,e **<++><Esc>F*i
autocmd Filetype markdown,rmd inoremap ,h ====<Space><++><Esc>F=hi
autocmd Filetype markdown,rmd inoremap ,i ![](<++>)<++><Esc>F[a
autocmd Filetype markdown,rmd inoremap ,a [](<++>)<++><Esc>F[a
autocmd Filetype markdown,rmd inoremap ,1 #<Space><Enter><++><Esc>kA
autocmd Filetype markdown,rmd inoremap ,2 ##<Space><Enter><++><Esc>kA
autocmd Filetype markdown,rmd inoremap ,3 ###<Space><Enter><++><Esc>kA
autocmd Filetype markdown,rmd inoremap ,l --------<Enter>
autocmd Filetype markdown,rmd inoremap ,r ```{r}<CR>```<CR><CR><esc>2kO
autocmd Filetype markdown,rmd inoremap ,p ```{python}<CR>```<CR><CR><esc>2kO
autocmd Filetype mardown,rmd inoremap ,c ```<cr>```<cr><cr><esc>2kO
""".xml
autocmd FileType xml inoremap ,e <item><Enter><title><++></title><Enter><guid<space>isPermaLink="false"><++></guid><Enter><pubDate><Esc>:put<Space>=strftime('%a, %d %b %Y %H:%M:%S %z')<Enter>kJA</pubDate><Enter><link><++></link><Enter><description><![CDATA[<++>]]></description><Enter></item><Esc>?<title><enter>cit
autocmd FileType xml inoremap ,a <a href="<++>"><++></a><++><Esc>F"ci"
"""I like COC
let g:coc_global_extensions = ['coc-json', 'coc-texlab', 'coc-svg', 'coc-docker', 'coc-lua', 'coc-perl', 'coc-r-lsp', 'coc-tsserver', 'coc-emmet', 'coc-clangd', 'coc-html-css-support', 'coc-go', 'coc-css', 'coc-perl', 'coc-yaml', 'coc-svelte', 'coc-sql', 'coc-sh']
" Set internal encoding of vim, not needed on neovim, since coc.nvim using some
" unicode characters in the file autoload/float.vim
set encoding=utf-8
" TextEdit might fail if hidden is not set.
set hidden
" Some servers have issues with backup files, see #649.
set nobackup
set nowritebackup
" Give more space for displaying messages.
set cmdheight=2
" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
" delays and poor user experience.
set updatetime=300
" Don't pass messages to |ins-completion-menu|.
set shortmess+=c
" Always show the signcolumn, otherwise it would shift the text each time
" diagnostics appear/become resolved.
if has("nvim-0.5.0") || has("patch-8.1.1564")
" Recently vim can merge signcolumn and number column into one
set signcolumn=number
else
set signcolumn=yes
endif
" Use tab for trigger completion with characters ahead and navigate.
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
" other plugin before putting this into your config.
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ "\<tab>"
inoremap <expr><S-tab> pumvisible() ? "\<C-p>" : "\<C-h>"
let g:coc#disable_startup_autoselect = 1
" confirms selection if any or just break line if none
function! EnterSelect()
" if the popup is visible and an option is not selected
if pumvisible() && complete_info()["selected"] == -1
return "\<C-y>\<Enter>"
" if the pum is visible and an option is selected
elseif pumvisible()
return coc#_select_confirm()
" if the pum is not visible
else
return "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
endif
endfunction
" makes <CR> confirm selection if any or just break line if none
inoremap <silent><expr> <cr> EnterSelect()
" Use <c-space> to trigger completion.
if has('nvim')
inoremap <silent><expr> <c-space> pumvisible() ? coc#_select_confirm()
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
else
inoremap <silent><expr> <c-@> coc#refresh()
endif
" Use `[g` and `]g` to navigate diagnostics
" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list.
nmap <silent> [g <Plug>(coc-diagnostic-prev)
nmap <silent> ]g <Plug>(coc-diagnostic-next)
" GoTo code navigation.
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
" Use K to show documentation in preview window.
nnoremap <silent> K :call <SID>show_documentation()<CR>
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
elseif (coc#rpc#ready())
call CocActionAsync('doHover')
else
execute '!' . &keywordprg . " " . expand('<cword>')
endif
endfunction
" Highlight the symbol and its references when holding the cursor.
autocmd CursorHold * silent call CocActionAsync('highlight')
" Symbol renaming.
nmap <leader>rn <Plug>(coc-rename)
" Formatting selected code.
xmap <leader>f <Plug>(coc-format-selected)
nmap <leader>f <Plug>(coc-format-selected)
augroup mygroup
autocmd!
" Setup formatexpr specified filetype(s).
autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
" Update signature help on jump placeholder.
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
augroup end
" Applying codeAction to the selected region.
" Example: `<leader>aap` for current paragraph
xmap <leader>a <Plug>(coc-codeaction-selected)
nmap <leader>a <Plug>(coc-codeaction-selected)
" Remap keys for applying codeAction to the current buffer.
nmap <leader>ac <Plug>(coc-codeaction)
" Apply AutoFix to problem on the current line.
nmap <leader>qf <Plug>(coc-fix-current)
" Run the Code Lens action on the current line.
nmap <leader>cl <Plug>(coc-codelens-action)
" Map function and class text objects
" NOTE: Requires 'textDocument.documentSymbol' support from the language server.
xmap if <Plug>(coc-funcobj-i)
omap if <Plug>(coc-funcobj-i)
xmap af <Plug>(coc-funcobj-a)
omap af <Plug>(coc-funcobj-a)
xmap ic <Plug>(coc-classobj-i)
omap ic <Plug>(coc-classobj-i)
xmap ac <Plug>(coc-classobj-a)
omap ac <Plug>(coc-classobj-a)
" Remap <C-f> and <C-b> for scroll float windows/popups.
if has('nvim-0.4.0') || has('patch-8.2.0750')
nnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
nnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
inoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<Right>"
inoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<Left>"
vnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
vnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
endif
" Use CTRL-S for selections ranges.
" Requires 'textDocument/selectionRange' support of language server.
nmap <silent> <C-s> <Plug>(coc-range-select)
xmap <silent> <C-s> <Plug>(coc-range-select)
" Add `:Format` command to format current buffer.
command! -nargs=0 Format :call CocActionAsync('format')
" Add `:Fold` command to fold current buffer.
command! -nargs=? Fold :call CocAction('fold', <f-args>)
" Add `:OR` command for organize imports of the current buffer.
command! -nargs=0 OR :call CocActionAsync('runCommand', 'editor.action.organizeImport')
" Add (Neo)Vim's native statusline support.
" NOTE: Please see `:h coc-status` for integrations with external plugins that
" provide custom statusline: lightline.vim, vim-airline.
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
"powerline symbols
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline_left_sep = ''
let g:airline_left_alt_sep = ''
let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
let g:airline_symbols.branch = ''
let g:airline_symbols.readonly = ''
let g:airline_symbols.linenr = ''
"let g:airline_symbols.maxlinenr = ' '
let g:airline_symbols.maxlinenr = ''
let g:airline_symbols.colnr = ':'
" Mappings for CoCList
" Show all diagnostics.
nnoremap <silent><nowait> <space>a :<C-u>CocList diagnostics<cr>
" Manage extensions.
nnoremap <silent><nowait> <space>e :<C-u>CocList extensions<cr>
" Show commands.
nnoremap <silent><nowait> <space>c :<C-u>CocList commands<cr>
" Find symbol of current document.
nnoremap <silent><nowait> <space>o :<C-u>CocList outline<cr>
" Search workspace symbols.
nnoremap <silent><nowait> <space>s :<C-u>CocList -I symbols<cr>
" Do default action for next item.
nnoremap <silent><nowait> <space>j :<C-u>CocNext<CR>
" Do default action for previous item.
nnoremap <silent><nowait> <space>k :<C-u>CocPrev<CR>
" Resume latest coc list.
nnoremap <silent><nowait> <space>p :<C-u>CocListResume<CR>
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
inoremap <silent><expr> <NUL> coc#refresh()

34
.config/papis/config Normal file
View File

@ -0,0 +1,34 @@
[papers]
dir = ~/dox/papers
extra-bibtex-keys = ["doc_url"]
use-git = True
formatter = jinja2
# Format folder & file in format <year>-<last_name_first_author>-<paper_title>
add-file-name = {{ doc.year }}-{{ (doc.author_list[0].family if doc.author_list else "AUTHOR_MISSING") }}-{{ ' '.join(doc.title.split()[:10]) }}
add-folder-name = {{ doc.year }}-{{ (doc.author_list[0].family if doc.author_list else "AUTHOR_MISSING") }}-{{ ' '.join(doc.title.split()[:10]) }}
ref-format = {{doc.author_list[0].family if doc.author_list else "AUTHOR MISSING"}}{{doc.year}}{{doc.title.title().translate(None, ' -')[:15]}}
# Defaults simply converted to jinja2
header-format = <ansired>{{doc.html_escape.title}}</ansired>\n <ansigreen>{{doc.html_escape.author}}</ansigreen>\n <ansiblue>({{doc.html_escape.year}})</ansiblue> [<ansiyellow>{{doc.html_escape.tags}}</ansiyellow>]
match-format = {{doc.tags}}{{doc.subfolder}}{{doc.title}}{{doc.author}}{{doc.year}}
document-description-format = {{doc.title}} - {{doc.author}}
multiple-authors-format = {{au.family}}, {{au.given}}
browse-query-format = {{doc.title}} {{doc.author}}
notes-name = notes.md
[books]
dir = ~/dox/books
add-file-name = {doc[author]}{doc[title]}
use-git = True
[settings]
opentool = rifle
default-library = papers
file-browser = ranger
[tui]
editmode = vi
options_list.selected_margin_style = bg:ansigreen fg:ansired
options_list.unselected_margin_style =

View File

@ -3,9 +3,7 @@ username_extractor=regex_search
regex_username=^user: (.*)$
[github.com]
username=AlexBocken
target=dev/Github_Token
[bocken.org]
username=Alexander
target=dev/personal_gitea
[git.bocken.org]
target=dev/Gitea_Token

View File

@ -101,7 +101,7 @@ fade-out-step = 0.03;
# Opacity of inactive windows. (0.1 - 1.0, defaults to 1.0)
# inactive-opacity = 1
inactive-opacity = 0.8;
inactive-opacity = 1.0;
# Opacity of window titlebars and borders. (0.1 - 1.0, disabled by default)
# frame-opacity = 1.0

View File

@ -1,247 +0,0 @@
# Daemon config file for PipeWire version "0.3.40" #
#
# Copy and edit this file in /etc/pipewire for system-wide changes
# or in ~/.config/pipewire 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 = true
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 = 32
#default.clock.max-quantum = 8192
#default.video.width = 640
#default.video.height = 480
#default.video.rate.num = 25
#default.video.rate.denom = 1
#
# 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
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 RTKit to boost the data thread priority.
{ name = libpipewire-module-rtkit
args = {
#nice.level = -11
#rt.prio = 88
#rt.time.soft = 2000000
#rt.time.hard = 2000000
}
flags = [ ifexists nofail ]
}
# Set thread priorities without using RTKit.
#{ name = libpipewire-module-rt
# args = {
# nice.level = -11
# rt.prio = 88
# rt.time.soft = 2000000
# rt.time.hard = 2000000
# }
# 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 }
]
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" }
]

View File

@ -6,5 +6,88 @@
config_version: 2
settings:
bindings.commands:
global:
normal:
',C': spawn -d st castyt {url}
',S': spawn -d mpvallvids {url}
',V': spawn -d startmpv {url}
',X': spawn -d dmenuhandler {url}
',c': hint links spawn -d st castyt {hint-url}
',s': hint links spawn -d mpvallvids {hint-url}
',v': hint links spawn -d startmpv {hint-url}
',x': hint links spawn -d dmenuhandler {hint-url}
aO: download-open;; download-remove;; close
ao: download-open;; download-remove
ar: download-remove
gP: open -p {url}
u: undo --window
colors.webpage.darkmode.algorithm:
global: lightness-cielab
colors.webpage.darkmode.contrast:
global: 0.5
colors.webpage.darkmode.enabled:
global: false
colors.webpage.darkmode.threshold.background:
global: 100
colors.webpage.preferred_color_scheme:
global: light
content.cookies.accept:
global: no-3rdparty
content.desktop_capture:
https://meet.bocken.org: true
content.headers.user_agent:
global: Mozilla/5.0 ({os_info}) AppleWebKit/{webkit_version} (KHTML, like Gecko)
{qt_key}/{qt_version} {upstream_browser_key}/{upstream_browser_version} Safari/{webkit_version}
content.javascript.clipboard:
global: access-paste
content.javascript.enabled:
global: true
content.media.audio_capture:
https://meet.bocken.org: true
https://meet.piribauer.de: true
https://teams.microsoft.com: true
content.media.audio_video_capture:
https://meet.bocken.org: true
https://meet.piribauer.de: true
https://teams.microsoft.com: true
content.media.video_capture:
https://meet.bocken.org: true
https://meet.piribauer.de: true
https://teams.microsoft.com: true
content.notifications.enabled:
https://cloud.bocken.org: true
https://stream.bocken.org: true
https://teams.microsoft.com: true
content.pdfjs:
global: false
downloads.location.directory:
global: /tmp
downloads.location.prompt:
global: false
editor.command:
global:
- st
- nvim
- -f
- '{file}'
- -c
- normal
- '{line}G{column}l'
prompt.filebrowser:
global: true
url.searchengines:
global:
DEFAULT: https://bocken.org/searx/?q={}
brave: https://search.brave.com/search?q={}&source=web
cactus: https://latin.cactus2000.de/index.php?q={}
ddg: https://duckduckgo.com/?q={}
dw: https://www.dwds.de/wb/{}
gg: https://linggle.com/?q={}
jisho: jisho.org/search/{}
ling: https://www.linguee.com/english-german/search?source=auto&query={}
nyaa: nyaa.si/?q={}
oz: http://www.ozdic.com/collocation-dictionary/{}
re: https://bocken.org/rezepte?q={}
sx: https://bocken.org/searx/?q={}
yt: https://www.youtube.com/results?search_query={}

View File

@ -1,12 +1,13 @@
import dracula.draw
# Load existing settings made via :set
config.load_autoconfig(False)
config.load_autoconfig()
c.auto_save.session = False
c.backend = "webengine"
c.bindings.commands = { "normal":
{
"<Alt-Return>": "open -t {url}",
"u": "undo --window",
",C": "spawn -d st castyt {url}",
",S": "spawn -d mpvallvids {url}",
@ -28,11 +29,10 @@ c.content.blocking.method = "both"
c.content.desktop_capture = "ask"
c.content.fullscreen.window = False
c.content.headers.user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36"
c.content.javascript.enabled = True
#c.content.javascript.enabled = True # make editable via autoconfig
c.content.local_content_can_access_remote_urls = True
c.content.notifications.presenter = "libnotify"
c.content.javascript.clipboard = "access-paste"
from os.path import expanduser
c.downloads.location.directory = expanduser("~")
@ -42,7 +42,7 @@ c.downloads.open_dispatcher = "rifle {}"
c.downloads.position = "top"
c.downloads.remove_finished = 1000000
c.editor.command = [ "st", "nvim", "-f", "'{file}'", "-c", "normal", "{line}G{column}" ]
c.editor.command = [ "st", "nvim", "-f", "{file}", "-c", "normal {line}G{column}l" ]
c.fileselect.folder.command = [ "st", "-e", "ranger", "--choosedir={}" ]
c.fileselect.handler = "external"
c.fileselect.multiple_files.command = [ "st", "-e", "ranger", "--choosefiles={}" ]
@ -69,6 +69,7 @@ c.url.default_page = local_startpage
c.url.open_base_url = True
searchengines = {
"sx": "https://searx.bocken.org/?q={}",
"brave": "https://search.brave.com/search?q={}&source=web",
"cactus": "https://latin.cactus2000.de/index.php?q={}",
"ddg": "https://duckduckgo.com/?q={}",
@ -78,10 +79,10 @@ searchengines = {
"ling": "https://www.linguee.com/english-german/search?source=auto&query={}",
"nyaa": "nyaa.si/?q={}",
"oz": "http://www.ozdic.com/collocation-dictionary/{}",
"re": "https://bocken.org/rezepte/?q={}",
"re": "https://bocken.org/rezepte?q={}",
"yt": "https://www.youtube.com/results?search_query={}"
}
searchengines["DEFAULT"] = searchengines["brave"]
searchengines["DEFAULT"] = searchengines["sx"]
c.url.searchengines = searchengines
c.zoom.default = "160%"

View File

@ -281,13 +281,10 @@ set save_tabs_on_exit false
# Enable scroll wrapping - moving down while on the last item will wrap around to
# the top and vice versa.
set wrap_scroll false
map grm cd ~/eth/hrm
map gpm cd ~/eth/pm
map gre cd ~/eth/recht
map grt cd ~/eth/rt2
map gvl cd vl
map gus cd üs
map gz cd zsf
# go to path in clipboard (command: xclip -selection clipboard -o)
map gd eval fm.cd(os.popen('xclip -selection clipboard -o').read().strip())
# go to path of file in clipboard
map gp eval fm.cd(os.path.dirname(os.popen('xclip -selection clipboard -o').read().strip()))
map glb cd ~/.local/bin

View File

@ -89,6 +89,7 @@
ext sc, has sc-im, X, flag t = sc-im -- "$@"
mime text/calendar, has calcurse, flag f = calendaradd "$@"
name ^.*\.bands\.agr$, has xmgrace, X, flag f = xmgrace -- "$@"
ext svelte, label editor = ${VISUAL:-$EDITOR} -- "$@"
# Define the "editor" for text files as first action
@ -129,7 +130,7 @@ ext midi?, terminal, has wildmidi = wildmidi -- "$@"
#-------------------------------------------
mime ^video|audio, has gmplayer, X, flag f = gmplayer -- "$@"
mime ^video|audio, has smplayer, X, flag f = smplayer "$@"
mime ^video, has mpv, X, flag f = mpv -- "$@"
mime ^video|audio, has mpv, X, flag f = mpv -- "$@"
mime ^video, has mpv, X, flag f = mpv --fs -- "$@"
mime ^video, has mplayer2, X, flag f = mplayer2 -- "$@"
mime ^video, has mplayer2, X, flag f = mplayer2 -fs -- "$@"

View File

@ -294,7 +294,7 @@ handle_mime() {
exit 1;;
## Text
text/* | */xml)
text/*|*/xml|application/javascript)
## Syntax highlight
if [[ "$( stat --printf='%s' -- "${FILE_PATH}" )" -gt "${HIGHLIGHT_SIZE_MAX}" ]]; then
exit 2

View File

@ -36,6 +36,7 @@ export XDG_VIDEOS_DIR="$HOME/vids"
#Various stuff
export BIB="$XDG_DOCUMENTS_DIR/bib.bib"
export MATES_DIR="${XDG_DATA_HOME:-$HOME/.local/share/}/vdirsyncer/contacts/"
#export XDG_RUNTIME_DIR="$HOME/.cache/xdg_run" # Messes up Audio for some reason, might be useful to figure out in the future how to fix
#export XAUTHORITY="$HOME/.cache/xdg_run/Xauthority" # This line will break some DMs.
export CHROOT="${HOME}/.local/src/chroot"

19
.config/vdirsyncer/config Normal file
View File

@ -0,0 +1,19 @@
[general]
status_path = "~/.config/vdirsyncer/status/"
[pair nextcloud_contacts]
a = "nextcloud_contacts_local"
b = "nextcloud_contacts_remote"
collections = ["from a", "from b"]
[storage nextcloud_contacts_local]
type = "filesystem"
path = "~/.local/share/vdirsyncer/"
fileext = ".vcf"
[storage nextcloud_contacts_remote]
type = "carddav"
url = "https://cloud.bocken.org/remote.php/dav/addressbooks/users/alexander/contacts/"
auth = "basic"
username = "alexander"
password.fetch = ["shell", "pass Misc/NC_vdirsyncer | head -n1"]

View File

@ -14,10 +14,11 @@ autostart="picom mpd dunst unclutter dwmblocks update_musicbar pipewire remapd p
for program in $autostart; do
pidof -s "$program" || setsid -f "$program"
done >/dev/null 2>&1
sleep 30 && jellyfin-mpv-shim & # Start jellyfin-mpv-shim after 30 seconds, to ensure that internet is connected (bodged, not relevant though)
xrandr --auto
xrandr --dpi 180 # Set DPI. User may want to use a larger number for larger screens.
xrandr --listactivemonitors | grep -qE '1920.*x1080.*HDMI-1-3$' && ( xrandr --output HDMI-1-3 --scale 1.666666666666 && setbg ) # set scale for 2nd monitor if connected
xrandr --dpi 140 # Set DPI. User may want to use a larger number for larger screens.
sb-bright 40 # set brighntess by default to 40% instead of ~38%
xrandr --listactivemonitors | grep -qE '1920.*x1080.*DP-7$' && ( xrandr --output DP-7 --scale 1.666666666666 && setbg ) # set scale for 2nd monitor if connected
echo "$DBUS_SESSION_BUS_ADDRESS" > /tmp/dbus_session_bus_address
# Ensure that xrdb has finished running before moving on to start the WM/DE.

View File

@ -14,4 +14,6 @@ map i recolor
map p print
map g goto top
map <C-s> exec zathura_backward_search.sh
map <A-Return> exec ranger_at_file $FILE
map <A-Return> exec "openfilebrowser $FILE"
map <C-h> exec "movepdf $FILE"
map y exec "copyfilepath $FILE"

View File

@ -1,4 +1,4 @@
#files: 827 version: 5.9
#files: 858 version: 5.9
_comps=(
'-' '_precommand'
@ -50,6 +50,10 @@ _comps=(
'appletviewer' '_java'
'apropos' '_man'
'apvlv' '_pdf'
'archbuild' '_devtools'
'arch-chroot' '_archinstallscripts'
'arch-nspawn' '_devtools'
'archrelease' '_devtools'
'arduino-ctags' '_ctags'
'arecord' '_alsa-utils'
'arena' '_webbrowser'
@ -60,6 +64,7 @@ _comps=(
'asciidoctor' '_asciidoctor'
'asciinema' '_asciinema'
'ash' '_sh'
'asp' '_asp'
'-assign-parameter-' '_assign'
'at' '_at'
'atq' '_at'
@ -88,12 +93,16 @@ _comps=(
'bibtex' '_bibtex'
'bindkey' '_bindkey'
'bison' '_bison'
'black' '_black'
'blackd' '_blackd'
'bluetoothctl' '_bluetoothctl'
'bmake' '_make'
'bogofilter' '_bogofilter'
'bogotune' '_bogofilter'
'bogoutil' '_bogofilter'
'bootctl' '_bootctl'
'borg' '_borg'
'borgfs' '_borg'
'bpython' '_bpython'
'bpython2' '_bpython'
'bpython2-gtk' '_bpython'
@ -124,6 +133,7 @@ _comps=(
'bunzip2' '_bzip2'
'burst' '_mh'
'busctl' '_busctl'
'bwrap' '_bwrap'
'bzcat' '_bzip2'
'bzegrep' '_grep'
'bzfgrep' '_grep'
@ -149,12 +159,15 @@ _comps=(
'ceilometer' '_openstack'
'certtool' '_gnutls'
'cftp' '_twisted'
'chafa' '_chafa'
'chage' '_users'
'chattr' '_chattr'
'chcon' '_chcon'
'chdir' '_cd'
'checkpkg' '_devtools'
'checkupdates' '_checkupdates'
'chfn' '_users'
'chg' '_hg'
'chgrp' '_chown'
'chimera' '_webbrowser'
'chkconfig' '_chkconfig'
@ -188,6 +201,10 @@ _comps=(
'-command-' '_autocd'
'command' '_command'
'-command-line-' '_normal'
'commitpkg' '_devtools'
'communitypkg' '_devtools'
'community-stagingpkg' '_devtools'
'community-testingpkg' '_devtools'
'comp' '_mh'
'compadd' '_compadd'
'compdef' '_compdef'
@ -201,6 +218,7 @@ _comps=(
'configure' '_configure'
'convert' '_imagemagick'
'coredumpctl' '_coredumpctl'
'corepkg' '_devtools'
'cowsay' '_cowsay'
'cowthink' '_cowsay'
'cp' '_cp'
@ -247,6 +265,7 @@ _comps=(
'dict' '_dict'
'diff' '_diff'
'diff3' '_diff3'
'diffpkg' '_devtools'
'diffstat' '_diffstat'
'dig' '_dig'
'dillo' '_webbrowser'
@ -263,8 +282,10 @@ _comps=(
'dmesg' '_dmesg'
'dmidecode' '_dmidecode'
'doas' '_doas'
'docker' '_docker'
'domainname' '_yp'
'dos2unix' '_dos2unix'
'downgrade' '_downgrade'
'drill' '_drill'
'dropbox' '_dropbox'
'dropdb' '_postgresql'
@ -319,6 +340,8 @@ _comps=(
'express' '_webbrowser'
'extcheck' '_java'
'extractres' '_psutils'
'extrapkg' '_devtools'
'extra-x86_64-build' '_devtools'
'fakeroot' '_fakeroot'
'false' '_nothing'
'fc' '_fc'
@ -333,6 +356,7 @@ _comps=(
'filterdiff' '_patchutils'
'find' '_find'
'findaffix' '_ispell'
'finddeps' '_devtools'
'findmnt' '_findmnt'
'finger' '_finger'
'firefox' '_mozilla'
@ -402,6 +426,7 @@ _comps=(
'geany' '_geany'
'gegrep' '_grep'
'gem' '_gem'
'genfstab' '_archinstallscripts'
'genisoimage' '_genisoimage'
'genv' '_env'
'get' '_sccs'
@ -453,6 +478,7 @@ _comps=(
'gnl' '_nl'
'gnocchi' '_openstack'
'gnome-gv' '_gnome-gv'
'gnome-unstable-x86_64-build' '_devtools'
'gnumfmt' '_numfmt'
'gnupod_addsong' '_gnupod'
'gnupod_addsong.pl' '_gnupod'
@ -573,6 +599,7 @@ _comps=(
'heat' '_openstack'
'help' '_sccs'
'hexdump' '_hexdump'
'hg' '_hg'
'hilite' '_precommand'
'histed' '_zed'
'history' '_fc'
@ -638,19 +665,27 @@ _comps=(
'journalctl' '_journalctl'
'jq' '_jq'
'jupyter' '_jupyter'
'kcmshell5' '_systemsettings'
'kcmshell6' '_systemsettings'
'kdeconnect-cli' '_kdeconnect'
'kde-inhibit' '_kde-inhibit'
'kde-unstable-x86_64-build' '_devtools'
'kernel-install' '_kernel-install'
'keystone' '_openstack'
'keytool' '_java'
'kfmclient' '_kfmclient'
'khard' '_khard'
'kill' '_kill'
'killall' '_killall'
'killall5' '_killall'
'kinfocenter' '_systemsettings'
'kioclient' '_kfmclient'
'knock' '_knock'
'konqueror' '_webbrowser'
'kpartx' '_kpartx'
'kpdf' '_pdf'
'krunner' '_krunner'
'kscreen-doctor' '_kscreen-doctor'
'ksh' '_sh'
'ksh88' '_sh'
'ksh93' '_sh'
@ -724,8 +759,10 @@ _comps=(
'Mail' '_mail'
'mailx' '_mail'
'make' '_make'
'makechrootpkg' '_devtools'
'makeinfo' '_texinfo'
'makepkg' '_pacman'
'makerepropkg' '_devtools'
'man' '_man'
'manage.py' '_django'
'manila' '_openstack'
@ -749,6 +786,7 @@ _comps=(
'mencal' '_mencal'
'mere' '_mere'
'merge' '_rcs'
'meson' '_meson'
'metaflac' '_flac'
'mformat' '_mtools'
'mgv' '_pspdf'
@ -762,6 +800,7 @@ _comps=(
'mhstore' '_mh'
'mii-tool' '_mii-tool'
'mistral' '_openstack'
'mkarchroot' '_devtools'
'mkdir' '_mkdir'
'mkfifo' '_mkfifo'
'mkinitcpio' '_mkinitcpio'
@ -805,6 +844,11 @@ _comps=(
'mtoolstest' '_mtools'
'mtr' '_mtr'
'mtype' '_mtools'
'multilib-build' '_devtools'
'multilibpkg' '_devtools'
'multilib-staging-build' '_devtools'
'multilib-testing-build' '_devtools'
'multilib-testingpkg' '_devtools'
'munchlist' '_ispell'
'mupdf' '_mupdf'
'murano' '_openstack'
@ -863,6 +907,7 @@ _comps=(
'nvim' '_vim'
'objdump' '_objdump'
'od' '_od'
'offload-build' '_devtools'
'ogg123' '_vorbis'
'oggdec' '_vorbis'
'oggenc' '_vorbis'
@ -882,6 +927,7 @@ _comps=(
'pacat' '_pulseaudio'
'paccache' '_paccache'
'pacdiff' '_pacdiff'
'pacignore' '_pacignore'
'pack' '_pack'
'packf' '_mh'
'paclist' '_paclist'
@ -894,11 +940,14 @@ _comps=(
'pacscripts' '_pacscripts'
'pacsearch' '_pacsearch'
'pacsort' '_pacsort'
'pacstrap' '_archinstallscripts'
'pactl' '_pulseaudio'
'pactree' '_pactree'
'padsp' '_pulseaudio'
'pandoc' '_pandoc'
'papis' '_papis'
'paplay' '_pulseaudio'
'parallel' '_parallel'
'-parameter-' '_parameter'
'parec' '_pulseaudio'
'parecord' '_pulseaudio'
@ -908,6 +957,7 @@ _comps=(
'paste' '_paste'
'pasuspender' '_pulseaudio'
'patch' '_patch'
'patchelf' '_patchelf'
'pax' '_pax'
'pcat' '_pack'
'pcp-htop' '_htop'
@ -915,6 +965,7 @@ _comps=(
'pdf2dsc' '_pdf'
'pdf2ps' '_pdf'
'pdffonts' '_pdf'
'pdfgrep' '_pdfgrep'
'pdfimages' '_pdf'
'pdfinfo' '_pdf'
'pdfjadetex' '_tex'
@ -953,9 +1004,11 @@ _comps=(
'ping6' '_ping'
'pkgadd' '_pkgadd'
'pkg-config' '_pkg-config'
'pkgctl' '_devtools'
'pkginfo' '_pkginfo'
'pkgrm' '_pkgrm'
'pkill' '_pgrep'
'plasmashell' '_plasmashell'
'pldd' '_pids'
'pmake' '_make'
'pman' '_perl_modules'
@ -972,6 +1025,7 @@ _comps=(
'podgrep' '_perl_modules'
'podpath' '_perl_modules'
'podtoc' '_perl_modules'
'poetry' '_poetry'
'poff' '_pon'
'policytool' '_java'
'pon' '_pon'
@ -1026,7 +1080,7 @@ _comps=(
'pyhtmlizer' '_twisted'
'qdbus' '_qdbus'
'qiv' '_qiv'
'_qrcp' '_qrcp'
'qpdf' '_qpdf'
'qrcp' '_qrcp'
'quilt' '_quilt'
'r' '_fc'
@ -1147,6 +1201,7 @@ _comps=(
'showchar' '_psutils'
'showmount' '_showmount'
'shred' '_shred'
'shtab' '_shtab'
'shuf' '_shuf'
'shutdown' '_shutdown'
'sisu' '_sisu'
@ -1165,6 +1220,7 @@ _comps=(
'smbstatus' '_samba'
'soa' '_hosts'
'socket' '_socket'
'sogrep' '_devtools'
'sort' '_sort'
'sortm' '_mh'
'source' '_source'
@ -1184,6 +1240,8 @@ _comps=(
'sshfs' '_sshfs'
'ssh-keygen' '_ssh'
'ssh-keyscan' '_ssh'
'stagingpkg' '_devtools'
'staging-x86_64-build' '_devtools'
'star' '_tar'
'start' '_initctl'
'stat' '_stat'
@ -1235,6 +1293,7 @@ _comps=(
'systemd-run' '_systemd-run'
'systemd-tmpfiles' '_systemd-tmpfiles'
'systemd-tty-ask-password-agent' '_systemd'
'systemsettings' '_systemsettings'
'tac' '_tac'
'tacker' '_openstack'
'tail' '_tail'
@ -1251,6 +1310,8 @@ _comps=(
'tdr' '_devtodo'
'tee' '_tee'
'telnet' '_telnet'
'testingpkg' '_devtools'
'testing-x86_64-build' '_devtools'
'tex' '_tex'
'texi2any' '_texinfo'
'texi2dvi' '_texinfo'
@ -1268,6 +1329,7 @@ _comps=(
'tkconch' '_twisted'
'tkinfo' '_texinfo'
'tla' '_tla'
'tldr' '_tldr'
'tload' '_tload'
'tmux' '_tmux'
'todo' '_devtodo'
@ -1285,7 +1347,6 @@ _comps=(
'transmission-remote' '_transmission'
'trap' '_trap'
'tree' '_tree'
'tremc' '_tremc'
'trial' '_twisted'
'trove' '_openstack'
'true' '_nothing'
@ -1305,6 +1366,7 @@ _comps=(
'type' '_which'
'typeset' '_typeset'
'udevadm' '_udevadm'
'udisksctl' '_udisks2'
'ulimit' '_ulimit'
'uml_mconsole' '_uml'
'uml_moo' '_uml'
@ -1443,6 +1505,7 @@ _comps=(
'wipefs' '_wipefs'
'wodim' '_cdrecord'
'wpa_cli' '_wpa_cli'
'wpctl' '_wpctl'
'write' '_users_on'
'www' '_webbrowser'
'xargs' '_xargs'
@ -1565,8 +1628,15 @@ _comps=(
_services=(
'bzcat' 'bunzip2'
'communitypkg' 'commitpkg'
'community-stagingpkg' 'commitpkg'
'community-testingpkg' 'commitpkg'
'corepkg' 'commitpkg'
'extrapkg' 'commitpkg'
'extra-x86_64-build' 'archbuild'
'gchgrp' 'chgrp'
'gchown' 'chown'
'gnome-unstable-x86_64-build' 'archbuild'
'gnupod_addsong.pl' 'gnupod_addsong'
'gnupod_check.pl' 'gnupod_check'
'gnupod_INIT.pl' 'gnupod_INIT'
@ -1574,11 +1644,17 @@ _services=(
'gpg2' 'gpg'
'gzcat' 'gunzip'
'iceweasel' 'firefox'
'kde-unstable-x86_64-build' 'archbuild'
'lzcat' 'unxz'
'lzma' 'xz'
'Mail' 'mail'
'mailx' 'mail'
'mktunes.pl' 'mktunes'
'multilib-build' 'archbuild'
'multilibpkg' 'commitpkg'
'multilib-staging-build' 'archbuild'
'multilib-testing-build' 'archbuild'
'multilib-testingpkg' 'commitpkg'
'nail' 'mail'
'ncl' 'nc'
'nedit-nc' 'nc'
@ -1598,9 +1674,13 @@ _services=(
'-redirect-,>,xz' 'unxz'
'remsh' 'rsh'
'slogin' 'ssh'
'stagingpkg' 'commitpkg'
'staging-x86_64-build' 'archbuild'
'svnadmin-static' 'svnadmin'
'svnlite' 'svn'
'svnliteadmin' 'svnadmin'
'testingpkg' 'commitpkg'
'testing-x86_64-build' 'archbuild'
'tunes2pod.pl' 'tunes2pod'
'unlzma' 'unxz'
'xelatex' 'latex'
@ -1632,6 +1712,7 @@ _postpatcomps=(
'shasum(|5).*' '_shasum'
'(texi(2*|ndex))' '_texi'
'(tiff*|*2tiff|pal2rgb)' '_tiff'
'-value-,BORG_*,-default-' '_borg'
'-value-,(ftp|http(|s))_proxy,-default-' '_urls'
'-value-,LC_*,-default-' '_locales'
'-value-,*path,-default-' '_directories'
@ -1677,18 +1758,24 @@ bindkey '^[,' _history-complete-newer
bindkey '^[/' _history-complete-older
bindkey '^[~' _bash_complete-word
autoload -Uz _bat _bluetoothctl _bootctl _bun _busctl \
_cargo _checkupdates _coredumpctl _curl _email-notmuch \
_hostnamectl _img2sixel _journalctl _jupyter _kernel-install \
_libinput _localectl _loginctl _machinectl _mkinitcpio \
_mpv _mutt-wizard.zsh _networkctl _ninja _notmuch \
_oomctl _paccache _pacdiff _paclist _paclog-pkglist \
_pacman _pacscripts _pacsearch _pacsort _pactree \
_paru _pass _pulseaudio _qrcp _rankmirrors \
_rclone _resolvectl _sd_hosts_or_user_at_host _sd_machines _sd_outputmodes \
_sd_unit_files _systemctl _systemd _systemd-analyze _systemd-delta \
_systemd-inhibit _systemd-nspawn _systemd-path _systemd-run _systemd-tmpfiles \
_timedatectl _tremc _udevadm _updpkgsums _xwallpaper \
autoload -Uz _archinstallscripts _asp _bat _black _blackd \
_bluetoothctl _bootctl _borg _bun _busctl \
_bwrap _cargo _chafa _checkupdates _coredumpctl \
_curl _devtools _docker _downgrade _email-khard \
_email-notmuch _hg _hostnamectl _img2sixel _journalctl \
_jupyter _kde-inhibit _kernel-install _khard _krunner \
_kscreen-doctor _libinput _localectl _loginctl _machinectl \
_meson _mkinitcpio _mpv _mutt-wizard.zsh _networkctl \
_ninja _notmuch _oomctl _paccache _pacdiff \
_pacignore _paclist _paclog-pkglist _pacman _pacscripts \
_pacsearch _pacsort _pactree _papis _parallel \
_paru _pass _patchelf _pdfgrep _pip \
_plasmashell _poetry _pulseaudio _qpdf _qrcp \
_rankmirrors _rclone _resolvectl _sd_hosts_or_user_at_host _sd_machines \
_sd_outputmodes _sd_unit_files _shtab _systemctl _systemd \
_systemd-analyze _systemd-delta _systemd-inhibit _systemd-nspawn _systemd-path \
_systemd-run _systemd-tmpfiles _systemsettings _timedatectl _tldr \
_udevadm _udisks2 _updpkgsums _wpctl _xwallpaper \
_yay _yt-dlp _zathura _cdr _all_labels \
_all_matches _alternative _approximate _arg_compile _arguments \
_bash_completions _cache_invalid _call_function _combination _complete \

View File

@ -6,10 +6,7 @@
#automatically scale HD screens to better work with hidpi
scale_factor_HD=${1:-1.6666}
scale_outputs="HDMI-3
DP-2
HDMI-1-3
DP1-2"
scale_outputs="HDMI-1 DP-7"
#fixes issue that script gets called twice for some reason
@ -45,7 +42,7 @@ twoscreen() { # If multi-monitor is selected and there are two screens.
primary=$(echo "$screens" | dmenu -i -p "Select primary display:")
secondary=$(echo "$screens" | grep -v "$primary")
direction=$(printf "left\\nright" | dmenu -i -p "What side of $primary should $secondary be on?")
if $(echo "$scale_outputs" | grep -q "$primary"); then
if echo "$scale_outputs" | grep -q "$primary"; then
xrandr --output "$primary" --auto --scale $scale_factor_HD --output "$secondary" --"$direction"-of "$primary" --auto --scale 1.0x1.0
elif $(echo "$scale_outputs" | grep -q "$seconday"); then
xrandr --output "$primary" --auto --scale 1.0x1.0 --output "$secondary" --"$direction"-of "$primary" --auto --scale $scale_factor_HD

View File

@ -3,21 +3,18 @@ PASS_DIR=Misc/SaferVPN
USER='alexander@bocken.org'
ETH_user="abocken@student-net.ethz.ch"
ETH_password_path="ETH/VPN"
ETH_OTP_path="OTP/nETHz"
choice="$(ls "${XDG_CONFIG_HOME}/openvpn/cfgs" | sed 's/\.ovpn//' | awk 'BEGIN {print "ETH"}; {print $0}' | dmenu -i -p 'connect with which vpn server?' -l 10)"
[ -z "$choice" ] && exit
if [ "$choice" = "ETH" ]; then
if [ $(pgrep -c openconnect) -eq 0 ]; then
transmission-remote -u 0
transmission-remote -d 0
pass "$ETH_password_path" | sudo openconnect -g student-net -u "$ETH_user" --passwd-on-stdin sslvpn.ethz.ch &
printf "%s\n%s\n" "$(pass "$ETH_password_path")" "$(pass otp "$ETH_OTP_path")" | sudo openconnect --useragent=AnyConnect -g student-net -u "$ETH_user" --passwd-on-stdin sslvpn.ethz.ch &
if ping -c 3 -W 3 -q webprint.ethz.ch ;then
notify-send "ETH VPN" "ETH VPN connected"
fi
elif ping -c 1 -W 2 -q webprint.ethz.ch ;then
sudo pkill openconnect && notify-send "ETH VPN" "ETH VPN disconnected"
transmission-remote -U
transmission-remote -D
fi
else
printf '%s\n%s\n' "$USER" "$(pass $PASS_DIR)" > /tmp/tmp_pass

7
.local/bin/moodle-dl-update Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
MOODLE_DIR="/home/alex/eth/.moodle"
cd "$MOODLE_DIR"
if ! pgrep -x moodle-dl; then
[ -f running.lock ] && rm running.lock
moodle-dl >/dev/null 2>&1
fi

View File

@ -1,7 +1,6 @@
#!/bin/sh
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus
export DBUS_SESSION_BUS_ADDRESS
export DISPLAY=:0.0
export DBUS_SESSION_BUS_ADDRESS=$(cat /tmp/dbus_session_bus_address)
#export DISPLAY=:0.0
newsboat -x reload & pid=$!
sleep 60
sleep 120
kill -15 $pid

View File

@ -5,8 +5,8 @@
VIRTUAL_PRINTER_DIR="/var/spool/cups-pdf/$USER"
# Printer to print magazine layout on
PRINTER="Canon-MF220"
PRINTER=Virtual_PDF_Printer
file="$@"
#PRINTER=Virtual_PDF_Printer
file="$1"
lpr -P Virtual_PDF_Printer -o number-up=2 -o orientation-requested=4 -o fit-to-page -o media=a4 "$file"
str="."
until lpc status | grep -A 4 'Virtual_PDF_Printer:' | tail -n1 | grep 'no entries'; do

2
.local/bin/scanner Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
QT_SCALE_FACTOR=1.6666666666666666 skanlite

View File

@ -23,9 +23,10 @@ do
echo "Error. Capacity:$capacity" > /dev/stderr &&
continue
# do not display full batteries (nice to unclutter status bars for laptops mostly used stationiary)
[ "$capacity" -eq 100 ] &&
printf '\n' &&
if [ "$capacity" -eq 100 ] || grep -q "Full" "$battery"/status; then
printf '\n'
continue
fi
unset status
status=$(sed "s/Not charging/🛑/" "$battery"/status)

39
.local/bin/statusbar/sb-bright Executable file
View File

@ -0,0 +1,39 @@
#!/bin/sh
# A small script manually writing into the /sys/class/backlight/* files
# If multiple go through all and apply changes/printout status
# if no first argument is given prints out current status
# else: apply changes (+/- -> relative, only number: -> absolute)
# numbers in percentages
for backlight in "/sys/class/backlight/"*; do
max_brightness=$(cat $backlight/max_brightness)
current_brightness_abs=$(cat $backlight/brightness)
current_brightness_rel="$(echo "$current_brightness_abs * 100 / $max_brightness" | bc -l | xargs printf '%.0f')"
# For statusbar
if [ -z $1 ]; then
echo "☀️$current_brightness_rel%"
# continue as relative changes can result in differing brightness for multiple backlights
continue
fi
max(){
echo $(( $1 > $2 ? $1 : $2 ))
}
min(){
echo $(( $1 < $2 ? $1 : $2 ))
}
limit(){
echo $(min $(max $1 0) 100)
}
if echo $1 | grep -q '^[+-]'; then
new_brightness_rel=$(limit $(echo $current_brightness_rel $1 | bc))
else
new_brightness_rel=$(limit $1)
fi
new_brightness_abs=$(echo "($new_brightness_rel * $max_brightness)/ 100" | bc)
echo "$new_brightness_abs" | sudo tee $backlight/brightness > /dev/null
done
[ -z $1 ] ||
pkill -RTMIN+2 dwmblocks

View File

@ -1,2 +0,0 @@
#!/bin/bash
echo ☀$(bc <<< "scale=0; $(cat /sys/class/backlight/intel_backlight/brightness) /9.37")%

View File

@ -21,10 +21,10 @@ esac
if [ "$(cat /sys/class/net/w*/operstate 2>/dev/null)" = 'up' ] ; then
wifiicon="$(awk '/^\s*w/ { print "" }' /proc/net/wireless)"
elif [ "$(cat /sys/class/net/w*/operstate 2>/dev/null)" = 'down' ] ; then
[ "$(cat /sys/class/net/w*/flags 2>/dev/null)" = '0x1003' ] && wifiicon=" " || wifiicon="❌ "
[ "$(cat /sys/class/net/w*/flags 2>/dev/null)" = '0x1003' ] && wifiicon="" || wifiicon="❌"
fi
# Ethernet
[ "$(cat /sys/class/net/e*/operstate 2>/dev/null)" = 'up' ] && ethericon=""
[ "$(cat /sys/class/net/e*/operstate 2>/dev/null)" = 'up' ] && wifiicon=""
printf "%s%s%s\n" "$wifiicon" "$ethericon"
printf "%s%s%s\n" "$wifiicon"

View File

@ -1,5 +1,5 @@
#!/bin/bash
pgrep openconnect > /dev/null || if ping -c 1 -W 1 -q webprint.ethz.ch > /dev/null
if ping -c 1 -W 1 -q webprint.ethz.ch > /dev/null;
then
printf '🔬'
fi

51
.local/bin/syncclouds.sh Executable file
View File

@ -0,0 +1,51 @@
#!/bin/sh
# cronjob requires this
# shellcheck disable=SC1090
. ~/.zprofile
# sync moodle
echo "syncclouds.sh: moodle-dl"
{
# remove lock file if moodle-dl is not running
pgrep -x moodle-dl || [ -f ~/eth/.moodle/running.lock ] && rm ~/eth/.moodle/running.lock
cd ~/eth/.moodle && moodle-dl
}
moodle_pid=$!
# sync nextcloud drive
echo "syncclouds.sh: nextcloudcmd"
{
nextcloudcmd -u "alexander" --password "$(pass show Misc/nextcloud_token | head -n1)" ~/dox/nextcloud https://cloud.bocken.org
}
nextcloud_pid=$!
# sync contacts to nextcloud
echo "syncclouds.sh: vdirsyncer"
{
vdirsyncer sync
}
vdirsyncer_pid=$!
# sync calendar to nextcloud
echo "syncclouds.sh: calcurse-caldav"
{
# remove lock file if calcurse-caldav is not running
pgrep -x calcurse-caldav || [ -f ~/.local/share/calcurse/caldav/lock ] && rm ~/.local/share/calcurse/caldav/lock
CALCURSE_CALDAV_PASSWORD=$(pass Misc/calcurse_token) calcurse-caldav
}
calcurse_pid=$!
# Wait for all processes to complete and print a message for each one
# This does not print in the correct order (meaning first done first printed), but it's good enough
wait $vdirsyncer_pid
echo "syncclouds.sh: vdirsyncer done"
wait $nextcloud_pid
echo "syncclouds.sh: nextcloudcmd done"
wait $calcurse_pid
echo "syncclouds.sh: calcurse-caldav done"
wait $moodle_pid
echo "syncclouds.sh: moodle-dl done"
echo "syncclouds.sh done"

View File

@ -4,21 +4,10 @@ for file in $@; do
INPUTPDF=/tmp/file.pdf
cp -f "$file" $INPUTPDF
printf '\\documentclass[a4paper,final]{article}
\\usepackage{pdfpages}
\\usepackage{ifpdf,ifxetex,everyshi}
\\makeatletter
\\ifpdf
\\EveryShipout{\\ifodd\\c@page\\else\\pdfpageattr{/Rotate 180}\\fi}%%
\\fi
\\ifxetex
\\EveryShipout{\\ifodd\\c@page\\special{pdf: put @thispage << /Rotate 180 >>}%%
\\fi
}
\\fi
\\makeatother
\\begin{document}
\\includepdf[pages=-, nup=1x2, booklet=true, landscape]{%s}
\\end{document}' "$INPUTPDF" > /tmp/tmp$$.tex
\\usepackage{pdfpages}
\\begin{document}
\\includepdf[pages=-, nup=2x1, booklet=true, landscape]{%s}
\\end{document}' "$INPUTPDF" > /tmp/tmp$$.tex
cd /tmp || exit
pdflatex /tmp/tmp$$.tex
only_filename="$(echo "$file" | awk -F/ '{print $NF}')"

3
.local/bin/tools/copyfilepath Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
printf %s "$*" | xclip -selection clipboard &&
notify-send "Copied to clipboard: $*"

View File

@ -11,7 +11,7 @@ makepathabsolute(){
echo "$dl_location"
}
choices="$(printf 'mpv\ncopy url\nqueue download\nrifle file\nqueue youtube-dl\nbrowser\nrip media\ncast')"
choices="$(printf 'mpv\ncopy url\nqueue download\nrifle file\nqueue youtube-dl\nbrowser\nrip media\ncast\nadd torrent\n')"
if echo "$1" | grep -q "4chan"; then
choices="$(printf '%s\nwatch thread' "$choices")"
fi
@ -41,4 +41,10 @@ case "$choice" in
"rip media") dest="$(dmenuinput 'name of folder:')"
lynx --dump --nonumbers --listonly "$1" | grep -E "\.(webm|mp4|gif|jpg|jpeg|png|pdf|epub|mobi|djvu)" | sort -u | xargs wget -P "$(makepathabsolute "$dest")"
notify-send "dmenuhandler" "all media ripped into $dest";;
"add torrent") echo "$1" | grep -q '^magnet:' && transadd "$1"
if echo "$1" | grep -q "\.torrent$"; then
curl -L "$1" -o "/tmp/torrentfile"
transadd "/tmp/torrentfile"
rm "/tmp/torrentfile"
fi
esac

9
.local/bin/tools/movepdf Executable file
View File

@ -0,0 +1,9 @@
#!/bin/sh
file="$1"
dest="$(find "$HOME" -maxdepth 5 -type d -not -path "$HOME/.*" | dmenu -i -p 'move to folder:')"
if ! [ -d "$dest" ]; then
mkdir -p "$dest"
fi
echo $dest
echo $file
mv "$file" "$dest"

7
.local/bin/tools/open_at_video Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
if echo $1 | grep -qv '^/'; then
absolute_path_file="$(pwd)/$1"
else
absolute_path_file="$1"
fi
$TERMINAL $FILE "${absolute_path_file%/*}"

View File

@ -14,6 +14,17 @@ if echo "$1" | grep -qE 'youtube.*list'; then
sed 's/^/https:\/\/www.youtube.com\/watch?v=/' |
xargs mpv --ytdl-format='bestvideo[ext=mp4][width<=1920][height<=1080]+bestaudio[ext=m4a]/best[ext=mp4]/best' ||
notify-send "startmpv" "An error has occured with playlist $playlist_id"
elif echo "$1" | grep -qE 'rumble.com'; then
notify-send "startmpv" "Rumble videos are not supported by mpv, first ripping, then playing..."
(
cd /tmp
yt-dlp "$1" &
# get the filename of the downloaded video
filename="$(yt-dlp -e "$1")"
sleep 5
mpv /tmp/$filename*part
rm /tmp/$filename*part
)
else
mpv --ytdl-format='bestvideo[ext=mp4][width<=1920][height<=1080]+bestaudio[ext=m4a]/best[ext=mp4]/best' "$1"
fi

View File

@ -4,7 +4,7 @@
#pgrep -x transmission-da || (transmission-daemon && notify-send "Starting transmission daemon..." && sleep 3 && pkill -RTMIN+12 dwmblocks)
host=https://bocken.org/transmission
host=https://bocken.org/transmission/rpc
user=alex
password=$(pass show server/seenas/transmission)
transmission-remote $host -n $user:$password -a "$@" && notify-send "🔽 Torrent added."

View File

@ -1,26 +1,6 @@
[MIME Cache]
application/pdf=chromium.desktop;wine-extension-pdf.desktop;
application/rdf+xml=chromium.desktop;
application/rss+xml=chromium.desktop;
application/rtf=wine-extension-rtf.desktop;
application/vnd.ms-htmlhelp=wine-extension-chm.desktop;
application/winhlp=wine-extension-hlp.desktop;
application/x-mswinurl=wine-extension-url.desktop;
application/x-mswrite=wine-extension-wri.desktop;
application/x-wine-extension-ini=wine-extension-ini.desktop;
application/x-wine-extension-msp=wine-extension-msp.desktop;
application/xhtml+xml=chromium.desktop;
application/xhtml_xml=chromium.desktop;
application/xml=chromium.desktop;wine-extension-xml.desktop;
image/gif=chromium.desktop;wine-extension-gif.desktop;
image/jpeg=chromium.desktop;wine-extension-jfif.desktop;wine-extension-jpe.desktop;
image/png=chromium.desktop;wine-extension-png.desktop;
image/webp=chromium.desktop;
text/html=browser.desktop;chromium.desktop;wine-extension-htm.desktop;
text/plain=wine-extension-txt.desktop;
text/vbscript=wine-extension-vbs.desktop;
text/xml=chromium.desktop;
text/html=browser.desktop;
x-scheme-handler/about=browser.desktop;
x-scheme-handler/http=browser.desktop;chromium.desktop;
x-scheme-handler/https=browser.desktop;chromium.desktop;
x-scheme-handler/http=browser.desktop;
x-scheme-handler/https=browser.desktop;
x-scheme-handler/unknown=browser.desktop;

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,420 @@
// ==UserScript==
// @name Youtube HD
// @author adisib
// @namespace namespace_adisib
// @description Select a youtube resolution and resize the player.
// @version 2023.08.22
// @match https://*.youtube.com/*
// @noframes
// @grant none
// ==/UserScript==
// The video will only resize when in theater mode on the main youtube website.
// By default only runs on youtube website, not players embeded on other websites, but there is experimental support for embeds.
// To enable experimental support for embedded players outside of YouTube website, do the following steps:
// add " @include * " to the script metadata
// remove " @noframes " from the script metadata
// 2023.08.19 + 2023.08.22
// Fix youtube breaking resize, again
(function() {
"use strict";
// --- SETTINGS -------
// Target Resolution to always set to. If not available, the next best resolution will be used.
const changeResolution = true;
const targetRes = "hd1080";
// Choices for targetRes are currently:
// "highres" >= ( 8K / 4320p / QUHD )
// "hd2880" = ( 5K / 2880p / UHD+ )
// "hd2160" = ( 4K / 2160p / UHD )
// "hd1440" = ( 1440p / QHD )
// "hd1080" = ( 1080p / FHD )
// "hd720" = ( 720p / HD )
// "large" = ( 480p )
// "medium" = ( 360p )
// "small" = ( 240p )
// "tiny" = ( 144p )
// Target Resolution for high framerate (60 fps) videos
// If null, it is the same as targetRes
const highFramerateTargetRes = null;
// If changePlayerSize is true, then the video's size will be changed on the page
// instead of using youtube's default (if theater mode is enabled).
// If useCustomSize is false, then the player will be resized to try to match the target resolution.
// If true, then it will use the customHeight variables (theater mode is always full page width).
const changePlayerSize = false;
const useCustomSize = false;
const customHeight = 600;
// If autoTheater is true, each video page opened will default to theater mode.
// This means the video will always be resized immediately if you are changing the size.
// NOTE: YouTube will not always allow theater mode immediately, the page must be fully loaded before theater can be set.
const autoTheater = true;
// If flushBuffer is false, then the first second or so of the video may not always be the desired resolution.
// If true, then the entire video will be guaranteed to be the target resolution, but there may be
// a very small additional delay before the video starts if the buffer needs to be flushed.
const flushBuffer = true;
// Setting cookies can allow some operations to perform faster or without a delay (e.g. theater mode)
// Some people don't like setting cookies, so this is false by default (which is the same as old behavior)
const allowCookies = false;
// Tries to set the resolution as early as possible.
// This might cause issues on youtube polymer layout, so disable if videos fail to load.
// If videos load fine, leave as true or resolution may fail to set.
const setResolutionEarly = true;
// Enables a temporary work around for an issue where users can get the wrong youtube error screen
// (Youtube has two of them for some reason and changing to theater mode moves the wrong one to the front)
// Try disabling if you can't interact with the video or you think you are missing an error message.
const enableErrorScreenWorkaround = true;
// --------------------
// --- GLOBALS --------
const DEBUG = false;
// Possible resolution choices (in decreasing order, i.e. highres is the best):
const resolutions = ['highres', 'hd2880', 'hd2160', 'hd1440', 'hd1080', 'hd720', 'large', 'medium', 'small', 'tiny'];
// youtube has to be at least 480x270 for the player UI
const heights = [4320, 2880, 2160, 1440, 1080, 720, 480, 360, 270, 270];
let doc = document, win = window;
// ID of the most recently played video
let recentVideo = "";
let foundHFR = false;
let setHeight = 0;
// --------------------
function debugLog(message)
{
if (DEBUG)
{
console.log("YTHD | " + message);
}
}
// --------------------
// Used only for compatability with webextensions version of greasemonkey
function unwrapElement(el)
{
if (el && el.wrappedJSObject)
{
return el.wrappedJSObject;
}
return el;
}
// --------------------
// Get video ID from the currently loaded video (which might be different than currently loaded page)
function getVideoIDFromURL(ytPlayer)
{
const idMatch = /(?:v=)([\w\-]+)/;
let id = "ERROR: idMatch failed; youtube changed something";
let matches = idMatch.exec(ytPlayer.getVideoUrl());
if (matches)
{
id = matches[1];
}
return id;
}
// --------------------
// Attempt to set the video resolution to desired quality or the next best quality
function setResolution(ytPlayer, resolutionList)
{
debugLog("Setting Resolution...");
const currentQuality = ytPlayer.getPlaybackQuality();
let res = targetRes;
if (highFramerateTargetRes && foundHFR)
{
res = highFramerateTargetRes;
}
// Youtube doesn't return "auto" for auto, so set to make sure that auto is not set by setting
// even when already at target res or above, but do so without removing the buffer for this quality
if (resolutionList.indexOf(res) >= resolutionList.indexOf(currentQuality))
{
if (ytPlayer.setPlaybackQualityRange !== undefined)
{
ytPlayer.setPlaybackQualityRange(res);
}
ytPlayer.setPlaybackQuality(res);
debugLog("Resolution Set To: " + res);
return;
}
const end = resolutionList.length - 1;
let nextBestIndex = Math.max(resolutionList.indexOf(res), 0);
let ytResolutions = ytPlayer.getAvailableQualityLevels();
debugLog("Available Resolutions: " + ytResolutions.join(", "));
while ( (ytResolutions.indexOf(resolutionList[nextBestIndex]) === -1) && nextBestIndex < end )
{
++nextBestIndex;
}
if (flushBuffer && currentQuality !== resolutionList[nextBestIndex])
{
let id = getVideoIDFromURL(ytPlayer);
if (id.indexOf("ERROR") === -1)
{
let pos = ytPlayer.getCurrentTime();
ytPlayer.loadVideoById(id, pos, resolutionList[nextBestIndex]);
}
debugLog("ID: " + id);
}
if (ytPlayer.setPlaybackQualityRange !== undefined)
{
ytPlayer.setPlaybackQualityRange(resolutionList[nextBestIndex]);
}
ytPlayer.setPlaybackQuality(resolutionList[nextBestIndex]);
debugLog("Resolution Set To: " + resolutionList[nextBestIndex]);
}
// --------------------
// Set resolution, but only when API is ready (it should normally already be ready)
function setResOnReady(ytPlayer, resolutionList)
{
if (ytPlayer.getPlaybackQuality === undefined)
{
win.setTimeout(setResOnReady, 100, ytPlayer, resolutionList);
}
else
{
let framerateUpdate = false;
if (highFramerateTargetRes)
{
let features = ytPlayer.getVideoData().video_quality_features;
if (features)
{
let isHFR = features.includes("hfr");
framerateUpdate = isHFR && !foundHFR;
foundHFR = isHFR;
}
}
let curVid = getVideoIDFromURL(ytPlayer);
if ((curVid !== recentVideo) || framerateUpdate)
{
recentVideo = curVid;
setResolution(ytPlayer, resolutionList);
let storedQuality = localStorage.getItem("yt-player-quality");
if (!storedQuality || storedQuality.indexOf(targetRes) === -1)
{
let tc = Date.now(), te = tc + 2592000000;
localStorage.setItem("yt-player-quality","{\"data\":\"" + targetRes + "\",\"expiration\":" + te + ",\"creation\":" + tc + "}");
}
}
}
}
// --------------------
function setTheaterMode(ytPlayer)
{
debugLog("Setting Theater Mode");
if (win.location.href.indexOf("/watch") !== -1)
{
let pageManager = unwrapElement(doc.getElementsByTagName("ytd-watch-flexy")[0]);
if (pageManager)
{
if (enableErrorScreenWorkaround)
{
const styleContent = "#error-screen { z-index: 42 !important } .ytp-error { display: none !important }";
let errorStyle = doc.getElementById("ythdErrorWorkaroundStyleSheet");
if (!errorStyle)
{
errorStyle = doc.createElement("style");
errorStyle.type = "text/css";
errorStyle.id = "ythdStyleSheet";
errorStyle.innerHTML = styleContent;
doc.head.appendChild(errorStyle);
}
else
{
errorStyle.innerHTML = styleContent;
}
}
try
{
pageManager.theaterModeChanged_(true);
}
catch (e)
{ /* Ignore internal youtube exceptions. */ }
}
}
}
// --------------------
function computeAndSetPlayerSize()
{
let height = customHeight;
if (!useCustomSize)
{
// don't include youtube search bar as part of the space the video can try to fit in
let heightOffsetEl = doc.getElementById("masthead");
let mastheadContainerEl = doc.getElementById("masthead-container");
let mastheadHeight = 50, mastheadPadding = 16;
if (heightOffsetEl && mastheadContainerEl)
{
mastheadHeight = parseInt(win.getComputedStyle(heightOffsetEl).height, 10);
mastheadPadding = parseInt(win.getComputedStyle(mastheadContainerEl).paddingBottom, 10) * 2;
}
let i = Math.max(resolutions.indexOf(targetRes), 0);
height = Math.min(heights[i], win.innerHeight - (mastheadHeight + mastheadPadding));
}
resizePlayer(height);
}
// --------------------
// resize the player
function resizePlayer(height)
{
debugLog("Setting video player size");
if (setHeight === height)
{
debugLog("Player size already set");
return;
}
let styleContent = "\
ytd-watch-flexy[theater]:not([fullscreen]) #player-theater-container.style-scope, \
ytd-watch-flexy[theater]:not([fullscreen]) #player-wide-container.style-scope, \
ytd-watch-flexy[theater]:not([fullscreen]) #full-bleed-container.style-scope { \
min-height: " + height + "px !important; max-height: none !important; height: " + height + "px !important }";
let ythdStyle = doc.getElementById("ythdStyleSheet");
if (!ythdStyle)
{
ythdStyle = doc.createElement("style");
ythdStyle.type = "text/css";
ythdStyle.id = "ythdStyleSheet";
ythdStyle.innerHTML = styleContent;
doc.head.appendChild(ythdStyle);
}
else
{
ythdStyle.innerHTML = styleContent;
}
setHeight = height;
win.dispatchEvent(new Event("resize"));
}
// --- MAIN -----------
function main()
{
let ytPlayer = doc.getElementById("movie_player") || doc.getElementsByClassName("html5-video-player")[0];
let ytPlayerUnwrapped = unwrapElement(ytPlayer);
if (autoTheater && ytPlayerUnwrapped)
{
if (allowCookies && doc.cookie.indexOf("wide=1") === -1)
{
doc.cookie = "wide=1; domain=.youtube.com";
}
setTheaterMode(ytPlayerUnwrapped);
}
if (changePlayerSize && win.location.host.indexOf("youtube.com") !== -1 && win.location.host.indexOf("gaming.") === -1)
{
computeAndSetPlayerSize();
window.addEventListener("resize", computeAndSetPlayerSize, true);
}
if (changeResolution && setResolutionEarly && ytPlayerUnwrapped)
{
setResOnReady(ytPlayerUnwrapped, resolutions);
}
if (changeResolution || autoTheater)
{
win.addEventListener("loadstart", function(e) {
if (!(e.target instanceof win.HTMLMediaElement))
{
return;
}
ytPlayer = doc.getElementById("movie_player") || doc.getElementsByClassName("html5-video-player")[0];
ytPlayerUnwrapped = unwrapElement(ytPlayer);
if (ytPlayerUnwrapped)
{
debugLog("Loaded new video");
if (changeResolution)
{
setResOnReady(ytPlayerUnwrapped, resolutions);
}
if (autoTheater)
{
setTheaterMode(ytPlayerUnwrapped);
}
}
}, true );
}
// This will eventually be changed to use the "once" option, but I want to keep a large range of browser support.
win.removeEventListener("yt-navigate-finish", main, true);
}
main();
// Youtube doesn't load the page immediately in new version so you can watch before waiting for page load
// But we can only set resolution until the page finishes loading
win.addEventListener("yt-navigate-finish", main, true);
})();

View File

@ -0,0 +1,18 @@
// ==UserScript==
// @name Auto Skip YouTube Ads
// @version 1.0.0
// @description Speed up and skip YouTube ads automatically
// @author jso8910
// @match *://*.youtube.com/*
// @exclude *://*.youtube.com/subscribe_embed?*
// ==/UserScript==
setInterval(() => {
document.querySelector('.videoAdUiSkipButton,.ytp-ad-skip-button')?.click()
const ad = [...document.querySelectorAll('.ad-showing')][0];
if (ad) {
document.querySelector('video').playbackRate = 10;
}
setTimeout( () => {
document.querySelector('.videoAdUiSkipButton,.ytp-ad-skip-button')?.click()
}, 5000)
}, 50)

View File

@ -0,0 +1,266 @@
// ==UserScript==
// @name photoprism bulkeditor
// @version 0.1
// @description bulkeditor
// @author andy@boeckler.org
// @match https://*/library/browse*
// @match https://*/library/all*
// @match https://*/library/albums/*/view*
// @match https://*/library/favorites*
// @namespace https://bilder.bocken.org/
// @updateURL https://gist.github.com/boecko/e2d0effe7c61976c22e6bc0a8ee645c7/raw/photoprismbulkeditor.user.js
// @downloadURL https://gist.github.com/boecko/e2d0effe7c61976c22e6bc0a8ee645c7/raw/photoprismbulkeditor.user.js
// @grant none
// ==/UserScript==
(function() {
'use strict';
// from https://gist.github.com/stephenchew/b73ecc75b77a84a92fa350048d5ca84f
//------- START
const isDefined = (value) => typeof value !== 'undefined' && value !== null;
/**
*
* @returns `true` if the field is set, `false` otherwise
*/
const updateField = (data, field) => {
const type = data[field].type;
const value = data[field].content;
if (!value) {
return false;
}
const element = document.forms[0].__vue__._data.inputs.find((element) =>
element.$el.className.includes(`input-${field}`)
);
switch (type.toLowerCase()) {
case 'prepend':
element.internalValue = value + ' ' + element.internalValue;
break;
case 'append':
element.internalValue += ' ' + value;
break;
case 'replace':
element.internalValue = value;
break;
default:
console.error(`'${type}' is not a valid way of updating a field.`);
return false;
}
return true;
};
const runBulk = async (data) => {
const validation = validateData(data);
if (validation) {
console.error('There is an error in the data:\n\n' + validation);
return;
}
console.time('bulk-edit');
try {
const pause = async (seconds) => new Promise((r) => setTimeout(r, seconds * 500));
let count = 0;
do {
let dirty = false;
if (window.interrupt) {
alert('Execution interrupted by user.');
delete window.interrupt;
return;
}
for (let field of Object.keys(data)) {
dirty |= updateField(data, field);
}
if (!dirty) {
console.warn('No field was set. Nothing has changed.');
return;
}
const applyButton = document.querySelector('button.action-apply');
applyButton.click();
count++;
const rightButton = document.querySelector('.v-toolbar__items .action-next');
if (rightButton.disabled) {
break;
}
await pause(1);
rightButton.click();
await pause(1);
} while (true);
const doneButton = document.querySelector('button.action-done');
doneButton.click();
console.info(`Bulk edited ${count} photos.`);
} finally {
console.timeEnd('bulk-edit');
}
};
/**
* Return LF delimited error message, or `null` if all is good.
*/
const validateData = (data) => {
if (!data) {
return 'No data provided.';
}
const error = [];
if (isDefined(data.day?.content)) {
const day = parseInt(data.day.content, 10);
if (isNaN(day) || day < -1 || day > 31 || day === 0) {
error.push('Day must be between 1 and 31. Set to -1 for "Unknown".');
}
data.day.type = 'replace';
}
if (isDefined(data.month?.content)) {
const month = parseInt(data.month.content, 10);
if (isNaN(month) || month < -1 || month > 12 || month === 0) {
error.push('Month must be between 1 and 12. Set to -1 for "Unknown".');
}
data.month.type = 'replace';
}
if (isDefined(data.year?.content)) {
const year = parseInt(data.year.content, 10);
const currentYear = new Date().getFullYear();
if ((isNaN(year) || year < 1750 || year > currentYear) && year !== -1) {
// 1750 is Photoprism defined year
error.push('Year must be between 1750 and ' + currentYear + '. Set to -1 for "Unknown".');
}
data.year.type = 'replace';
}
return error.length > 0 ? error.join('\n') : null;
};
//------- END
const runGpsBulkUpdate = async (url) => {
if(!url) return
let m = url.match(/@(.*)z/)
if( !m[1] ) {
console.warn("URL ist falsch", url)
return
}
let gpsCoords = m[1].split(',')
let data = {
latitude: {
content: gpsCoords[0],
type: 'replace'
},
longitude: {
content: gpsCoords[1],
type: 'replace'
},
altitude: {
content: 0,
type: 'replace'
}
}
if(gpsCoords[2] && gpsCoords[2].match(/^\d+$/)) {
data.altitude = {
content: gpsCoords[2],
type: 'replace'
}
}
console.log('runBulk', data);
return await runBulk(data);
// return true;
}
const runKeywordBulkUpdate = async () => {
let keywords = prompt("Keywords?")
if(!keywords) return
let data = {
keywords: {
content: keywords,
type: 'append',
}
}
return await runBulk(data);
// return true;
}
//------- greasmonkey code
const BTN_STYLE_1 = 'cursor: pointer; border: solid white'
const BTN_STYLE_2 = 'cursor: pointer; border: solid white; opacity:0.5'
const checkBoxes = {}
const inputs = {}
let submitNode = null
let bulkRunning = false
async function submitHandler(e) {
e.preventDefault()
let bulkData = {}
for(let name in checkBoxes) {
if(!checkBoxes[name].checked) continue
bulkData[name] = {
content: inputs[name].value,
type: 'replace'
}
}
if(Object.keys(bulkData).length == 0) return;
submitNode.disabled = true
submitNode.setAttribute('style', BTN_STYLE_2);
bulkRunning = true
await runBulk(bulkData);
bulkRunning = false
}
function addSubmitIfMissing() {
const selector = '.input-title input[type=text]'
let inputNode = document.querySelector(selector)
if( inputNode==null || inputNode.offsetParent == null) return
if(inputNode.nextSibling) return
let newSubmit = document.createElement('input');
newSubmit.setAttribute('type', 'submit');
newSubmit.setAttribute('value', 'Bulkchange');
newSubmit.setAttribute('style', BTN_STYLE_1);
inputNode.parentNode.append(newSubmit);
newSubmit.onclick = submitHandler
submitNode = newSubmit
}
function addCheckBoxIfMissing(name) {
const selector = '.input-' + name + ' input[type=text]'
let inputNode = document.querySelector(selector)
// wenn da und nicht unsichtbar
if( inputNode==null || inputNode.offsetParent == null) return
if(inputNode.nextSibling) return
let newCheckBox = document.createElement('input');
newCheckBox.setAttribute('type', 'checkbox');
inputNode.parentNode.append(newCheckBox);
checkBoxes[name] = newCheckBox
inputs[name] = inputNode
}
var checkExistTimer = setInterval(function () {
if(bulkRunning) return
addCheckBoxIfMissing('day')
addCheckBoxIfMissing('month')
addCheckBoxIfMissing('year')
addCheckBoxIfMissing('latitude')
addCheckBoxIfMissing('longitude')
addCheckBoxIfMissing('altitude')
addSubmitIfMissing()
},1000);
window.runBulk = runBulk
window.runGpsBulkUpdate = runGpsBulkUpdate
window.runKeywordBulkUpdate = runKeywordBulkUpdate
})();

View File

@ -0,0 +1,15 @@
// ==UserScript==
// @name Auto Remove Ads
// @version 1.0.2
// @description Autoremove static ads
// @author Alexander Bocken
// @match *://*.youtube.com/*
// @exclude *://*.youtube.com/subscribe_embed?*
// ==/UserScript==
setInterval(() => {
document.querySelectorAll('.ytd-page-top-ad-layout-renderer,.ytd-display-ad-renderer,.ytd-video-display-full-buttoned-renderer, ytd-display-ad-renderer,.ytd-banner-promo-renderer-background,.ytd-player-legacy-desktop-watch-ads-renderer,ytd-ad-slot-renderer').forEach(
el => {
el.remove();
})
document.querySelectorAll('[aria-label="Not interested"]').forEach(el => { el.click() })
}, 50)

View File

@ -0,0 +1,192 @@
// ==UserScript==
// @name sb.js userscript
// @description SponsorBlock userscript
// @namespace mchang.name
// @homepage https://github.com/mchangrh/sb.js
// @icon https://mchangrh.github.io/sb.js/icon.png
// @version 1.3.2
// @license LGPL-3.0-or-later
// @match https://www.youtube.com/watch*
// @connect sponsor.ajay.app
// @grant none
// ==/UserScript==
/* START OF SETTINGS */
// https://wiki.sponsor.ajay.app/w/Types
const categories = [
"sponsor",
"selfpromo",
"interaction",
"intro",
"outro",
"preview",
"music_offtopic",
"exclusive_access",
"poi_highlight",
]
const actionTypes = ["skip", "mute", "full", "poi"]
const skipThreshold = [0.2, 1] // skip from between time-[0] and time+[1]
const serverEndpoint = "https://sponsor.ajay.app"
const skipTracking = true
const highlightKey = "Enter"
// https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values
/* END OF SETTINGS */
/* sb.js - SponsorBlock for restrictive environments - by mchangrh
https://github.com/mchangrh/sb.js
Uses SponsorBlock data licensed used under CC BY-NC-SA 4.0 from https://sponsor.ajay.app/
LICENCED UNDER LGPL-3.0-or-later */
const VERSION = "1.3.2" // version constant
// initial setup
let video, videoID, muteEndTime
let skipSegments = new Map()
let muteSegments = new Map()
// functions
const getVideoID = () => new URL(window.location.href).searchParams.get("v")
function getJSON(url, callback) {
const xhr = new XMLHttpRequest()
xhr.open("GET", url)
xhr.responseType = "json"
xhr.onload = () => xhr.status == 200 ? callback(null, xhr.response) : callback(xhr.status)
xhr.send()
}
const trackSkip = uuid => {
if (!skipTracking) return
const xhr = new XMLHttpRequest()
xhr.open("POST", `${serverEndpoint}/api/viewedVideoSponsorTime?UUID=${uuid}`)
xhr.send()
}
function fetch(videoID) {
const url = `${serverEndpoint}/api/skipSegments?videoID=${videoID}&categories=${JSON.stringify(categories)}&actionTypes=${JSON.stringify(actionTypes)}`
const convertSegment = s => [s.segment[0], { end: s.segment[1], uuid: s.UUID }]
getJSON(url, (err, data) => {
if (err) return console.error("[SB.js]", "error fetching segments", err)
data.forEach(s => {
if (s.actionType === "skip") skipSegments.set(...convertSegment(s))
else if (s.actionType === "mute") muteSegments.set(...convertSegment(s))
else if (s.actionType === "full") createVideoLabel(s)
else if (s.actionType === "poi") createPOILabel(s)
})
console.log("[SB.js] Loaded Segments")
})
}
function skipOrMute() {
const currentTime = video.currentTime
// if mute time is over, unmute video
if (video.muted && currentTime >= muteEndTime) {
video.muted = false
muteEndTime = 0
}
// check for any skip starts
const skipEnd = findEndTime(currentTime, skipSegments)
if (skipEnd) video.currentTime = skipEnd
// check for any mute starts
const muteEnd = findEndTime(currentTime, muteSegments)
if (muteEnd) {
video.muted = true
muteEndTime = muteEnd
}
}
function findEndTime(now, map) {
let endTime
for (const startTime of map.keys()) {
if (
now + skipThreshold[0] >= startTime &&
now - startTime <= skipThreshold[1]
) { // within threshold
const segment = map.get(startTime)
endTime = segment.end
trackSkip(segment.uuid)
map.delete(startTime) // only use segment once
for (const overlapStart of map.keys()) {
// check for overlap
if (endTime >= overlapStart && overlapStart >= now) {
// move to end of overlaps
const overSegment = map.get(overlapStart)
endTime = overSegment.end
trackSkip(overSegment.uuid)
map.delete(overlapStart)
}
}
return endTime // early return
}
}
return endTime
}
function createPOILabel(poiLabel) {
createVideoLabel(poiLabel, "poi")
// add binding
const poi_listener = e => {
if (e.key === highlightKey) {
video.currentTime = poiLabel.segment[1]
trackSkip(poiLabel.UUID)
// remove label
document.querySelector("#sbjs-label-poi").style.display = "none"
document.removeEventListener("keydown", poi_listener)
}
}
document.addEventListener("keydown", poi_listener)
}
function createVideoLabel(videoLabel, type = "full") {
// await title
const title = document.querySelector("#title h1, h1.title.ytd-video-primary-info-renderer")
if (!title) {
setTimeout(createVideoLabel, 200, videoLabel)
return
}
const category = videoLabel.category
const fvString = category => `The entire video is ${category} and is too tightly integrated to be able to seperate`
const styles = {
// fg, bg, hover text
sponsor: ["#0d0", "#111", fvString("sponsor")],
selfpromo: ["#ff0", "#111", fvString("selfpromo")],
exclusive_access: ["#085", "#fff", "This video showcases a product, service or location that they've received free or subsidized access to"],
poi_highlight: ["#f18", "#fff", `Press ${highlightKey} to skip to the highlight`],
}
const style = styles[category]
const label = document.createElement("span")
label.title = style[2]
label.innerText = category
label.id = `sbjs-label-${type}`
label.style = `color: ${style[1]}; background-color: ${style[0]}; display: flex; margin: 0 5px;`
// prepend to title
title.style = "display: flex;"
title.prepend(label)
}
const reset = () => {
video = undefined
videoID = undefined
muteEndTime = 0
skipSegments = new Map()
muteSegments = new Map()
}
function setup() {
if (videoID === getVideoID()) return // already running correctly
console.log(`@mchangrh/SB.js ${VERSION} Loaded`)
console.log(`Uses SponsorBlock data licensed used under CC BY-NC-SA 4.0 from https://sponsor.ajay.app/`)
if (document.querySelector("#previewbar")) // exit if previewbar exists
return console.log("[SB.js] Extension Present, Exiting")
video = document.querySelector("video")
videoID = getVideoID()
fetch(videoID)
if (!video) return console.log("[SB.js] no video")
video.addEventListener("timeupdate", skipOrMute) // add event listeners
}
// reset on page change
document.addEventListener("yt-navigate-start", reset)
// will start setup once event listener fired
document.addEventListener("yt-navigate-finish", setup)
setup()