Compare commits
7 commits
49c06e2149
...
5ebf1fd8ee
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5ebf1fd8ee | ||
|
|
38ec00876b | ||
|
|
9069ee2bdf | ||
|
|
c24caa5ef6 | ||
|
|
96e0957583 | ||
|
|
b75aa6af0c | ||
|
|
98d7036623 |
6 changed files with 95 additions and 515 deletions
|
|
@ -47,7 +47,6 @@
|
||||||
"window.commandCenter": false,
|
"window.commandCenter": false,
|
||||||
"editor.lineNumbers": "relative",
|
"editor.lineNumbers": "relative",
|
||||||
"editor.lineHeight": 24,
|
"editor.lineHeight": 24,
|
||||||
"window.menuBarVisibility": "toggle",
|
|
||||||
"editor.minimap.enabled": false,
|
"editor.minimap.enabled": false,
|
||||||
"editor.overviewRulerBorder": false,
|
"editor.overviewRulerBorder": false,
|
||||||
"workbench.editor.enablePreviewFromCodeNavigation": true,
|
"workbench.editor.enablePreviewFromCodeNavigation": true,
|
||||||
|
|
@ -1126,6 +1125,4 @@
|
||||||
],
|
],
|
||||||
"editor.matchBrackets": "never",
|
"editor.matchBrackets": "never",
|
||||||
"workbench.statusBar.visible": false
|
"workbench.statusBar.visible": false
|
||||||
"dart.flutterSdkPath": "/home/kappa/down/pkgs/flutter",
|
}
|
||||||
"dart.flutterCustomEmulators": []
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,23 @@
|
||||||
#? Config file for btop v. 1.4.5
|
#? Config file for btop v.1.4.7
|
||||||
|
|
||||||
#* Name of a btop++/bpytop/bashtop formatted ".theme" file, "Default" and "TTY" for builtin themes.
|
#* Name of a btop++/bpytop/bashtop formatted ".theme" file, "Default" and "TTY" for builtin themes.
|
||||||
#* Themes should be placed in "../share/btop/themes" relative to binary or "$HOME/.config/btop/themes"
|
#* Themes should be placed in "../share/btop/themes" relative to binary or "$HOME/.config/btop/themes"
|
||||||
color_theme = "$HOME/.config/btop/themes/catppuccin_macchiato.theme"
|
color_theme = "Default"
|
||||||
|
|
||||||
#* If the theme set background should be shown, set to False if you want terminal background transparency.
|
#* If the theme set background should be shown, set to False if you want terminal background transparency.
|
||||||
theme_background = False
|
theme_background = true
|
||||||
|
|
||||||
#* Sets if 24-bit truecolor should be used, will convert 24-bit colors to 256 color (6x6x6 color cube) if false.
|
#* Sets if 24-bit truecolor should be used, will convert 24-bit colors to 256 color (6x6x6 color cube) if false.
|
||||||
truecolor = True
|
truecolor = true
|
||||||
|
|
||||||
#* Set to true to force tty mode regardless if a real tty has been detected or not.
|
#* Set to true to force tty mode regardless if a real tty has been detected or not.
|
||||||
#* Will force 16-color mode and TTY theme, set all graph symbols to "tty" and swap out other non tty friendly symbols.
|
#* Will force 16-color mode and TTY theme, set all graph symbols to "tty" and swap out other non tty friendly symbols.
|
||||||
force_tty = False
|
force_tty = false
|
||||||
|
|
||||||
|
#* Option to disable presets. Either the default preset, custom presets, or all presets.
|
||||||
|
#* "Off" All presets are enabled.
|
||||||
|
#* "Default" preset is disabled.#* "Custom" presets are disabled.#* "All" presets are disabled.
|
||||||
|
disable_presets = "Off"
|
||||||
|
|
||||||
#* Define presets for the layout of the boxes. Preset 0 is always all boxes shown with default settings. Max 9 presets.
|
#* Define presets for the layout of the boxes. Preset 0 is always all boxes shown with default settings. Max 9 presets.
|
||||||
#* Format: "box_name:P:G,box_name:P:G" P=(0 or 1) for alternate positions, G=graph symbol to use for box.
|
#* Format: "box_name:P:G,box_name:P:G" P=(0 or 1) for alternate positions, G=graph symbol to use for box.
|
||||||
|
|
@ -22,10 +27,16 @@ presets = "cpu:1:default,proc:0:default cpu:0:default,mem:0:default,net:0:defaul
|
||||||
|
|
||||||
#* Set to True to enable "h,j,k,l,g,G" keys for directional control in lists.
|
#* Set to True to enable "h,j,k,l,g,G" keys for directional control in lists.
|
||||||
#* Conflicting keys for h:"help" and k:"kill" is accessible while holding shift.
|
#* Conflicting keys for h:"help" and k:"kill" is accessible while holding shift.
|
||||||
vim_keys = False
|
vim_keys = false
|
||||||
|
|
||||||
|
#* Disable all mouse events.
|
||||||
|
disable_mouse = false
|
||||||
|
|
||||||
#* Rounded corners on boxes, is ignored if TTY mode is ON.
|
#* Rounded corners on boxes, is ignored if TTY mode is ON.
|
||||||
rounded_corners = True
|
rounded_corners = true
|
||||||
|
|
||||||
|
#* Use terminal synchronized output sequences to reduce flickering on supported terminals.
|
||||||
|
terminal_sync = true
|
||||||
|
|
||||||
#* Default symbols to use for graph creation, "braille", "block" or "tty".
|
#* Default symbols to use for graph creation, "braille", "block" or "tty".
|
||||||
#* "braille" offers the highest resolution but might not be included in all fonts.
|
#* "braille" offers the highest resolution but might not be included in all fonts.
|
||||||
|
|
@ -50,82 +61,88 @@ graph_symbol_net = "default"
|
||||||
graph_symbol_proc = "default"
|
graph_symbol_proc = "default"
|
||||||
|
|
||||||
#* Manually set which boxes to show. Available values are "cpu mem net proc" and "gpu0" through "gpu5", separate values with whitespace.
|
#* Manually set which boxes to show. Available values are "cpu mem net proc" and "gpu0" through "gpu5", separate values with whitespace.
|
||||||
shown_boxes = "proc cpu mem net"
|
shown_boxes = "cpu mem net proc"
|
||||||
|
|
||||||
#* Update time in milliseconds, recommended 2000 ms or above for better sample times for graphs.
|
#* Update time in milliseconds, recommended 2000 ms or above for better sample times for graphs.
|
||||||
update_ms = 2000
|
update_ms = 2000
|
||||||
|
|
||||||
#* Processes sorting, "pid" "program" "arguments" "threads" "user" "memory" "cpu lazy" "cpu direct",
|
#* Processes sorting, "pid" "program" "arguments" "threads" "user" "memory" "cpu lazy" "cpu direct",
|
||||||
#* "cpu lazy" sorts top process over time (easier to follow), "cpu direct" updates top process directly.
|
#* "cpu lazy" sorts top process over time (easier to follow), "cpu direct" updates top process directly.
|
||||||
proc_sorting = "cpu direct"
|
proc_sorting = "cpu lazy"
|
||||||
|
|
||||||
#* Reverse sorting order, True or False.
|
#* Reverse sorting order, True or False.
|
||||||
proc_reversed = False
|
proc_reversed = false
|
||||||
|
|
||||||
#* Show processes as a tree.
|
#* Show processes as a tree.
|
||||||
proc_tree = False
|
proc_tree = false
|
||||||
|
|
||||||
#* Use the cpu graph colors in the process list.
|
#* Use the cpu graph colors in the process list.
|
||||||
proc_colors = True
|
proc_colors = true
|
||||||
|
|
||||||
#* Use a darkening gradient in the process list.
|
#* Use a darkening gradient in the process list.
|
||||||
proc_gradient = True
|
proc_gradient = true
|
||||||
|
|
||||||
#* If process cpu usage should be of the core it's running on or usage of the total available cpu power.
|
#* If process cpu usage should be of the core it's running on or usage of the total available cpu power.
|
||||||
proc_per_core = False
|
proc_per_core = false
|
||||||
|
|
||||||
#* Show process memory as bytes instead of percent.
|
#* Show process memory as bytes instead of percent.
|
||||||
proc_mem_bytes = True
|
proc_mem_bytes = true
|
||||||
|
|
||||||
#* Show cpu graph for each process.
|
#* Show cpu graph for each process.
|
||||||
proc_cpu_graphs = True
|
proc_cpu_graphs = true
|
||||||
|
|
||||||
#* Use /proc/[pid]/smaps for memory information in the process info box (very slow but more accurate)
|
#* Use /proc/[pid]/smaps for memory information in the process info box (very slow but more accurate)
|
||||||
proc_info_smaps = False
|
proc_info_smaps = false
|
||||||
|
|
||||||
#* Show proc box on left side of screen instead of right.
|
#* Show proc box on left side of screen instead of right.
|
||||||
proc_left = False
|
proc_left = false
|
||||||
|
|
||||||
#* (Linux) Filter processes tied to the Linux kernel(similar behavior to htop).
|
#* (Linux) Filter processes tied to the Linux kernel(similar behavior to htop).
|
||||||
proc_filter_kernel = False
|
proc_filter_kernel = false
|
||||||
|
|
||||||
|
#* Should the process list follow the selected process when detailed view is open.
|
||||||
|
proc_follow_detailed = true
|
||||||
|
|
||||||
#* In tree-view, always accumulate child process resources in the parent process.
|
#* In tree-view, always accumulate child process resources in the parent process.
|
||||||
proc_aggregate = False
|
proc_aggregate = false
|
||||||
|
|
||||||
|
#* Should cpu and memory usage display be preserved for dead processes when paused.
|
||||||
|
keep_dead_proc_usage = false
|
||||||
|
|
||||||
#* Sets the CPU stat shown in upper half of the CPU graph, "total" is always available.
|
#* Sets the CPU stat shown in upper half of the CPU graph, "total" is always available.
|
||||||
#* Select from a list of detected attributes from the options menu.
|
#* Select from a list of detected attributes from the options menu.
|
||||||
cpu_graph_upper = "total"
|
cpu_graph_upper = "Auto"
|
||||||
|
|
||||||
#* Sets the CPU stat shown in lower half of the CPU graph, "total" is always available.
|
#* Sets the CPU stat shown in lower half of the CPU graph, "total" is always available.
|
||||||
#* Select from a list of detected attributes from the options menu.
|
#* Select from a list of detected attributes from the options menu.
|
||||||
cpu_graph_lower = "total"
|
cpu_graph_lower = "Auto"
|
||||||
|
|
||||||
#* If gpu info should be shown in the cpu box. Available values = "Auto", "On" and "Off".
|
#* If gpu info should be shown in the cpu box. Available values = "Auto", "On" and "Off".
|
||||||
show_gpu_info = "Auto"
|
show_gpu_info = "Auto"
|
||||||
|
|
||||||
#* Toggles if the lower CPU graph should be inverted.
|
#* Toggles if the lower CPU graph should be inverted.
|
||||||
cpu_invert_lower = True
|
cpu_invert_lower = true
|
||||||
|
|
||||||
#* Set to True to completely disable the lower CPU graph.
|
#* Set to True to completely disable the lower CPU graph.
|
||||||
cpu_single_graph = False
|
cpu_single_graph = false
|
||||||
|
|
||||||
#* Show cpu box at bottom of screen instead of top.
|
#* Show cpu box at bottom of screen instead of top.
|
||||||
cpu_bottom = False
|
cpu_bottom = false
|
||||||
|
|
||||||
#* Shows the system uptime in the CPU box.
|
#* Shows the system uptime in the CPU box.
|
||||||
show_uptime = True
|
show_uptime = true
|
||||||
|
|
||||||
#* Shows the CPU package current power consumption in watts. Requires running `make setcap` or `make setuid` or running with sudo.
|
#* Shows the CPU package current power consumption in watts. Requires running `make setcap` or `make setuid` or running with sudo.
|
||||||
show_cpu_watts = True
|
show_cpu_watts = true
|
||||||
|
|
||||||
#* Show cpu temperature.
|
#* Show cpu temperature.
|
||||||
check_temp = True
|
check_temp = true
|
||||||
|
|
||||||
#* Which sensor to use for cpu temperature, use options menu to select from list of available sensors.
|
#* Which sensor to use for cpu temperature, use options menu to select from list of available sensors.
|
||||||
cpu_sensor = "Auto"
|
cpu_sensor = "Auto"
|
||||||
|
|
||||||
#* Show temperatures for cpu cores also if check_temp is True and sensors has been found.
|
#* Show temperatures for cpu cores also if check_temp is True and sensors has been found.
|
||||||
show_coretemp = True
|
show_coretemp = true
|
||||||
|
|
||||||
#* Set a custom mapping between core and coretemp, can be needed on certain cpus to get correct temperature for correct core.
|
#* Set a custom mapping between core and coretemp, can be needed on certain cpus to get correct temperature for correct core.
|
||||||
#* Use lm-sensors or similar to see which cores are reporting temperatures on your machine.
|
#* Use lm-sensors or similar to see which cores are reporting temperatures on your machine.
|
||||||
|
|
@ -137,17 +154,20 @@ cpu_core_map = ""
|
||||||
temp_scale = "celsius"
|
temp_scale = "celsius"
|
||||||
|
|
||||||
#* Use base 10 for bits/bytes sizes, KB = 1000 instead of KiB = 1024.
|
#* Use base 10 for bits/bytes sizes, KB = 1000 instead of KiB = 1024.
|
||||||
base_10_sizes = True
|
base_10_sizes = false
|
||||||
|
|
||||||
#* Show CPU frequency.
|
#* Show CPU frequency.
|
||||||
show_cpu_freq = True
|
show_cpu_freq = true
|
||||||
|
|
||||||
|
#* How to calculate CPU frequency, available values: "first", "range", "lowest", "highest" and "average".
|
||||||
|
freq_mode = "first"
|
||||||
|
|
||||||
#* Draw a clock at top of screen, formatting according to strftime, empty string to disable.
|
#* Draw a clock at top of screen, formatting according to strftime, empty string to disable.
|
||||||
#* Special formatting: /host = hostname | /user = username | /uptime = system uptime
|
#* Special formatting: /host = hostname | /user = username | /uptime = system uptime
|
||||||
clock_format = "%X"
|
clock_format = "%X"
|
||||||
|
|
||||||
#* Update main ui in background when menus are showing, set this to false if the menus is flickering too much for comfort.
|
#* Update main ui in background when menus are showing, set this to false if the menus is flickering too much for comfort.
|
||||||
background_update = True
|
background_update = true
|
||||||
|
|
||||||
#* Custom cpu model name, empty string to disable.
|
#* Custom cpu model name, empty string to disable.
|
||||||
custom_cpu_name = ""
|
custom_cpu_name = ""
|
||||||
|
|
@ -157,58 +177,61 @@ custom_cpu_name = ""
|
||||||
disks_filter = ""
|
disks_filter = ""
|
||||||
|
|
||||||
#* Show graphs instead of meters for memory values.
|
#* Show graphs instead of meters for memory values.
|
||||||
mem_graphs = True
|
mem_graphs = true
|
||||||
|
|
||||||
#* Show mem box below net box instead of above.
|
#* Show mem box below net box instead of above.
|
||||||
mem_below_net = False
|
mem_below_net = false
|
||||||
|
|
||||||
#* Count ZFS ARC in cached and available memory.
|
#* Count ZFS ARC in cached and available memory.
|
||||||
zfs_arc_cached = True
|
zfs_arc_cached = true
|
||||||
|
|
||||||
#* If swap memory should be shown in memory box.
|
#* If swap memory should be shown in memory box.
|
||||||
show_swap = True
|
show_swap = true
|
||||||
|
|
||||||
#* Show swap as a disk, ignores show_swap value above, inserts itself after first disk.
|
#* Show swap as a disk, ignores show_swap value above, inserts itself after first disk.
|
||||||
swap_disk = True
|
swap_disk = true
|
||||||
|
|
||||||
#* If mem box should be split to also show disks info.
|
#* If mem box should be split to also show disks info.
|
||||||
show_disks = False
|
show_disks = true
|
||||||
|
|
||||||
#* Filter out non physical disks. Set this to False to include network disks, RAM disks and similar.
|
#* Filter out non physical disks. Set this to False to include network disks, RAM disks and similar.
|
||||||
only_physical = True
|
only_physical = true
|
||||||
|
|
||||||
#* Read disks list from /etc/fstab. This also disables only_physical.
|
#* Read disks list from /etc/fstab. This also disables only_physical.
|
||||||
use_fstab = True
|
use_fstab = true
|
||||||
|
|
||||||
#* Setting this to True will hide all datasets, and only show ZFS pools. (IO stats will be calculated per-pool)
|
#* Setting this to True will hide all datasets, and only show ZFS pools. (IO stats will be calculated per-pool)
|
||||||
zfs_hide_datasets = False
|
zfs_hide_datasets = false
|
||||||
|
|
||||||
#* Set to true to show available disk space for privileged users.
|
#* Set to true to show available disk space for privileged users.
|
||||||
disk_free_priv = False
|
disk_free_priv = false
|
||||||
|
|
||||||
#* Toggles if io activity % (disk busy time) should be shown in regular disk usage view.
|
#* Toggles if io activity % (disk busy time) should be shown in regular disk usage view.
|
||||||
show_io_stat = True
|
show_io_stat = true
|
||||||
|
|
||||||
#* Toggles io mode for disks, showing big graphs for disk read/write speeds.
|
#* Toggles io mode for disks, showing big graphs for disk read/write speeds.
|
||||||
io_mode = False
|
io_mode = false
|
||||||
|
|
||||||
#* Set to True to show combined read/write io graphs in io mode.
|
#* Set to True to show combined read/write io graphs in io mode.
|
||||||
io_graph_combined = False
|
io_graph_combined = false
|
||||||
|
|
||||||
#* Set the top speed for the io graphs in MiB/s (100 by default), use format "mountpoint:speed" separate disks with whitespace " ".
|
#* Set the top speed for the io graphs in MiB/s (100 by default), use format "mountpoint:speed" separate disks with whitespace " ".
|
||||||
#* Example: "/mnt/media:100 /:20 /boot:1".
|
#* Example: "/mnt/media:100 /:20 /boot:1".
|
||||||
io_graph_speeds = ""
|
io_graph_speeds = ""
|
||||||
|
|
||||||
|
#* Swap the positions of the upload and download speed graphs. When true, upload will be on top.
|
||||||
|
swap_upload_download = false
|
||||||
|
|
||||||
#* Set fixed values for network graphs in Mebibits. Is only used if net_auto is also set to False.
|
#* Set fixed values for network graphs in Mebibits. Is only used if net_auto is also set to False.
|
||||||
net_download = 100
|
net_download = 100
|
||||||
|
|
||||||
net_upload = 100
|
net_upload = 100
|
||||||
|
|
||||||
#* Use network graphs auto rescaling mode, ignores any values set above and rescales down to 10 Kibibytes at the lowest.
|
#* Use network graphs auto rescaling mode, ignores any values set above and rescales down to 10 Kibibytes at the lowest.
|
||||||
net_auto = True
|
net_auto = true
|
||||||
|
|
||||||
#* Sync the auto scaling for download and upload to whichever currently has the highest scale.
|
#* Sync the auto scaling for download and upload to whichever currently has the highest scale.
|
||||||
net_sync = True
|
net_sync = true
|
||||||
|
|
||||||
#* Starts with the Network Interface specified here.
|
#* Starts with the Network Interface specified here.
|
||||||
net_iface = ""
|
net_iface = ""
|
||||||
|
|
@ -217,26 +240,32 @@ net_iface = ""
|
||||||
base_10_bitrate = "Auto"
|
base_10_bitrate = "Auto"
|
||||||
|
|
||||||
#* Show battery stats in top right if battery is present.
|
#* Show battery stats in top right if battery is present.
|
||||||
show_battery = False
|
show_battery = true
|
||||||
|
|
||||||
#* Which battery to use if multiple are present. "Auto" for auto detection.
|
#* Which battery to use if multiple are present. "Auto" for auto detection.
|
||||||
selected_battery = "Auto"
|
selected_battery = "Auto"
|
||||||
|
|
||||||
#* Show power stats of battery next to charge indicator.
|
#* Show power stats of battery next to charge indicator.
|
||||||
show_battery_watts = True
|
show_battery_watts = true
|
||||||
|
|
||||||
#* Set loglevel for "~/.config/btop/btop.log" levels are: "ERROR" "WARNING" "INFO" "DEBUG".
|
#* Set loglevel for "~/.local/state/btop.log" levels are: "ERROR" "WARNING" "INFO" "DEBUG".
|
||||||
#* The level set includes all lower levels, i.e. "DEBUG" will show all logging info.
|
#* The level set includes all lower levels, i.e. "DEBUG" will show all logging info.
|
||||||
log_level = "WARNING"
|
log_level = "WARNING"
|
||||||
|
|
||||||
|
#* Automatically save current settings to config file on exit.
|
||||||
|
save_config_on_exit = true
|
||||||
|
|
||||||
#* Measure PCIe throughput on NVIDIA cards, may impact performance on certain cards.
|
#* Measure PCIe throughput on NVIDIA cards, may impact performance on certain cards.
|
||||||
nvml_measure_pcie_speeds = True
|
nvml_measure_pcie_speeds = true
|
||||||
|
|
||||||
#* Measure PCIe throughput on AMD cards, may impact performance on certain cards.
|
#* Measure PCIe throughput on AMD cards, may impact performance on certain cards.
|
||||||
rsmi_measure_pcie_speeds = True
|
rsmi_measure_pcie_speeds = true
|
||||||
|
|
||||||
#* Horizontally mirror the GPU graph.
|
#* Horizontally mirror the GPU graph.
|
||||||
gpu_mirror_graph = True
|
gpu_mirror_graph = true
|
||||||
|
|
||||||
|
#* Set which GPU vendors to show. Available values are "nvidia amd intel apple"
|
||||||
|
shown_gpus = "nvidia amd intel apple"
|
||||||
|
|
||||||
#* Custom gpu0 model name, empty string to disable.
|
#* Custom gpu0 model name, empty string to disable.
|
||||||
custom_gpu_name0 = ""
|
custom_gpu_name0 = ""
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ osd-color='#cad3f5'
|
||||||
osd-shadow-color='#24273a'
|
osd-shadow-color='#24273a'
|
||||||
|
|
||||||
# Screenshots
|
# Screenshots
|
||||||
screenshot-directory='~'
|
screenshot-directory='~/Pictures/Screenshots/'
|
||||||
screenshot-template='mpv-%f-%p'
|
screenshot-template='mpv-%f-%p'
|
||||||
|
|
||||||
# Enables best HW decoder; turn off for software decoding
|
# Enables best HW decoder; turn off for software decoding
|
||||||
|
|
|
||||||
|
|
@ -1,455 +0,0 @@
|
||||||
------------- Instructions -------------
|
|
||||||
-- -- Video Demonstration: https://www.youtube.com/watch?v=M4t7HYS73ZQ
|
|
||||||
-- IF USING WEBSOCKET (RECOMMENDED)
|
|
||||||
-- -- Install the mpv_webscoket extension: https://github.com/kuroahna/mpv_websocket
|
|
||||||
-- -- Open a LOCAL copy of https://github.com/Renji-XD/texthooker-ui
|
|
||||||
-- -- Configure the script (if you're not using the Lapis note format)
|
|
||||||
-- IF USING CLIPBOARD INSERTER (NOT RECOMMENDED)
|
|
||||||
-- -- Install the clipboard inserter plugin: https://github.com/laplus-sadness/lap-clipboard-inserter
|
|
||||||
-- -- Open the texthooker UI, enable the plugin and enable clipboard pasting: https://github.com/Renji-XD/texthooker-ui
|
|
||||||
-- BOTH
|
|
||||||
-- -- Wait for an unknown word and create the card with Yomichan.
|
|
||||||
-- -- Select all the subtitle lines you wish to add to the card and copy with Ctrl + c.
|
|
||||||
-- -- Press Ctrl + v in MPV to add the lines, their Audio and the currently paused image to the back of the card.
|
|
||||||
---------------------------------------
|
|
||||||
|
|
||||||
------------- Credits -------------
|
|
||||||
-- Credits and copyright go to Anacreon DJT: https://anacreondjt.gitlab.io/
|
|
||||||
------------------------------------
|
|
||||||
|
|
||||||
------------- Original Credits (Outdated) -------------
|
|
||||||
-- This script was made by users of 4chan's Daily Japanese Thread (DJT) on /jp/
|
|
||||||
-- More information can be found here http://animecards.site/
|
|
||||||
-- Message @Anacreon with bug reports and feature requests on Discord (https://animecards.site/discord/) or 4chan (https://boards.4channel.org/jp/#s=djt)
|
|
||||||
--
|
|
||||||
-- If you like this work please consider subscribing on Patreon!
|
|
||||||
-- https://www.patreon.com/Quizmaster
|
|
||||||
------------------------------------
|
|
||||||
|
|
||||||
local utils = require 'mp.utils'
|
|
||||||
local msg = require 'mp.msg'
|
|
||||||
|
|
||||||
------------- User Config -------------
|
|
||||||
-- Set these to match your field names in Anki
|
|
||||||
local FRONT_FIELD = "Vocab"
|
|
||||||
local SENTENCE_AUDIO_FIELD = "SentAudio"
|
|
||||||
local SENTENCE_FIELD = "INVALID" -- the sentence is better taken care of by yomitan itself.
|
|
||||||
local IMAGE_FIELD = "Image"
|
|
||||||
-- Optional padding and fade settings in seconds.
|
|
||||||
-- Padding grabs extra audio around your selected subs.
|
|
||||||
-- Fade does a volume fade effect at the beginning and end of the resulting audio.
|
|
||||||
local AUDIO_CLIP_FADE = 0.2
|
|
||||||
local AUDIO_CLIP_PADDING = 0.75
|
|
||||||
-- Optional play sentence audio automatically after card update
|
|
||||||
local AUTOPLAY_AUDIO = false
|
|
||||||
-- Optional screenshot image format. Valid options: "webp" or "png"
|
|
||||||
-- Change to "png" if you plan to view cards on iOS or Mac.
|
|
||||||
local IMAGE_FORMAT = "png"
|
|
||||||
-- Optional set to true if you want your volume in mpv to affect Anki card volume.
|
|
||||||
local USE_MPV_VOLUME = false
|
|
||||||
-- Set to true if you want writing to clipboard to be enabled by default.
|
|
||||||
-- The more modern and recommended alternative is to use the websocket.
|
|
||||||
local ENABLE_SUBS_TO_CLIP = false
|
|
||||||
|
|
||||||
---------------------------------------
|
|
||||||
|
|
||||||
------------- Internal Variables -------------
|
|
||||||
local subs = {}
|
|
||||||
local debug_mode = true
|
|
||||||
local use_powershell_clipboard = nil
|
|
||||||
local prefix = ""
|
|
||||||
---------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
------------- Setup -------------
|
|
||||||
if unpack ~= nil then table.unpack = unpack end
|
|
||||||
|
|
||||||
local o = {}
|
|
||||||
-- Possible platforms: windows, linux, macos
|
|
||||||
local platform = mp.get_property_native("platform")
|
|
||||||
if platform == "darwin" then
|
|
||||||
platform = "macos"
|
|
||||||
end
|
|
||||||
|
|
||||||
local display_server
|
|
||||||
if os.getenv("WAYLAND_DISPLAY") then
|
|
||||||
display_server = 'wayland'
|
|
||||||
elseif platform == 'linux' then
|
|
||||||
display_server = 'xorg'
|
|
||||||
else
|
|
||||||
display_server = ""
|
|
||||||
end
|
|
||||||
|
|
||||||
local function dlog(...)
|
|
||||||
if debug_mode then
|
|
||||||
print(...)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function verfiy_libmp3lame()
|
|
||||||
local encoderlist = mp.get_property("encoder-list")
|
|
||||||
if not encoderlist or not string.find(encoderlist, "libmp3lame") then
|
|
||||||
mp.osd_message("Error: libmp3lame encoder not found. Audio export will not work.\nPlease use a build of mpv with libmp3lame support.", 10)
|
|
||||||
msg.error("Error: libmp3lame encoder not found. MP3 audio export will not work.")
|
|
||||||
else
|
|
||||||
dlog("libmp3lame encoder found.")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
mp.register_event("file-loaded", verfiy_libmp3lame)
|
|
||||||
|
|
||||||
dlog("Detected Platform: " .. platform)
|
|
||||||
dlog("Detected display server: " .. display_server)
|
|
||||||
|
|
||||||
---------------------------------------
|
|
||||||
-- Handle requests to AnkiConnect
|
|
||||||
local function anki_connect(action, params)
|
|
||||||
local request = utils.format_json({action=action, params=params, version=6})
|
|
||||||
local args = {'curl', '-s', 'localhost:8765', '-X', 'POST', '-d', request}
|
|
||||||
|
|
||||||
dlog("AnkiConnect request: " .. request)
|
|
||||||
|
|
||||||
local result = utils.subprocess({ args = args, cancellable = false, capture_stderr = true })
|
|
||||||
|
|
||||||
if result.status ~= 0 then
|
|
||||||
msg.error("Curl command failed with status: " .. tostring(result.status))
|
|
||||||
msg.error("Stderr: " .. (result.stderr or "none"))
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
if not result.stdout or result.stdout == "" then
|
|
||||||
msg.error("Empty response from AnkiConnect")
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
dlog("AnkiConnect response: " .. result.stdout)
|
|
||||||
|
|
||||||
local success, parsed_result = pcall(function() return utils.parse_json(result.stdout) end)
|
|
||||||
if not success or not parsed_result then
|
|
||||||
msg.error("Failed to parse JSON response: " .. (result.stdout or "empty"))
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
return parsed_result
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Get media directory path from AnkiConnect
|
|
||||||
local function set_media_dir()
|
|
||||||
local media_dir_response = anki_connect('getMediaDirPath')
|
|
||||||
if not media_dir_response then
|
|
||||||
msg.error("Failed to communicate with AnkiConnect. Is Anki running and do you have AnkiConnect installed?")
|
|
||||||
mp.osd_message("Error: Failed to communicate with AnkiConnect. Is Anki running and do you have AnkiConnect installed?", 5)
|
|
||||||
return
|
|
||||||
elseif media_dir_response["error"] then
|
|
||||||
msg.error("AnkiConnect error: " .. tostring(media_dir_response["error"]))
|
|
||||||
mp.osd_message("AnkiConnect error: " .. tostring(media_dir_response["error"]), 5)
|
|
||||||
return
|
|
||||||
elseif media_dir_response["result"] then
|
|
||||||
prefix = media_dir_response["result"]
|
|
||||||
dlog("Got media directory path from AnkiConnect: " .. prefix)
|
|
||||||
else
|
|
||||||
msg.error("Unexpected response format from AnkiConnect")
|
|
||||||
mp.osd_message("Error: Unexpected response from AnkiConnect", 5)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function clean(s)
|
|
||||||
for _, ws in ipairs({'%s', ' ', '', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '', ' ', ' ', ' ', '', ''}) do
|
|
||||||
s = s:gsub(ws..'+', "")
|
|
||||||
end
|
|
||||||
return s
|
|
||||||
end
|
|
||||||
|
|
||||||
local function get_name(s, e)
|
|
||||||
return mp.get_property("filename"):gsub('%W','').. tostring(s) .. tostring(e)
|
|
||||||
end
|
|
||||||
|
|
||||||
local function get_clipboard()
|
|
||||||
local res
|
|
||||||
if platform == 'windows' then
|
|
||||||
res = utils.subprocess({ args = {
|
|
||||||
'powershell', '-NoProfile', '-Command', [[& {
|
|
||||||
Trap {
|
|
||||||
Write-Error -ErrorRecord $_
|
|
||||||
Exit 1
|
|
||||||
}
|
|
||||||
$clip = ""
|
|
||||||
if (Get-Command "Get-Clipboard" -errorAction SilentlyContinue) {
|
|
||||||
$clip = Get-Clipboard -Raw -Format Text -TextFormatType UnicodeText
|
|
||||||
} else {
|
|
||||||
Add-Type -AssemblyName PresentationCore
|
|
||||||
$clip = [Windows.Clipboard]::GetText()
|
|
||||||
}
|
|
||||||
$clip = $clip -Replace "`r",""
|
|
||||||
$u8clip = [System.Text.Encoding]::UTF8.GetBytes($clip)
|
|
||||||
[Console]::OpenStandardOutput().Write($u8clip, 0, $u8clip.Length)
|
|
||||||
}]]
|
|
||||||
} })
|
|
||||||
elseif platform == 'macos' then
|
|
||||||
return io.popen('LANG=en_US.UTF-8 pbpaste'):read("*a")
|
|
||||||
else -- platform == 'linux'
|
|
||||||
if display_server == 'wayland' then
|
|
||||||
res = utils.subprocess({ args = {
|
|
||||||
'wl-paste'
|
|
||||||
} })
|
|
||||||
else -- display_server == 'xorg'
|
|
||||||
res = utils.subprocess({ args = {
|
|
||||||
'xclip', '-selection', 'clipboard', '-out'
|
|
||||||
} })
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if not res.error then
|
|
||||||
return res.stdout
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function powershell_set_clipboard(text)
|
|
||||||
utils.subprocess({ args = {
|
|
||||||
'powershell', '-NoProfile', '-Command', [[Set-Clipboard -Value @"]] .. "\n" .. text .. "\n" .. [["@]]
|
|
||||||
}})
|
|
||||||
end
|
|
||||||
|
|
||||||
local function cmd_set_clipboard(text)
|
|
||||||
local cmd = 'echo ' .. text .. ' | clip';
|
|
||||||
mp.command("run cmd /D /C " .. cmd);
|
|
||||||
end
|
|
||||||
|
|
||||||
local function determine_clip_type()
|
|
||||||
powershell_set_clipboard([[Anacreon様]])
|
|
||||||
use_powershell_clipboard = get_clipboard() == [[Anacreon様]]
|
|
||||||
end
|
|
||||||
|
|
||||||
local function linux_set_clipboard(text)
|
|
||||||
if display_server == 'wayland' then
|
|
||||||
os.execute('wl-copy <<EOF\n' .. text .. '\nEOF\n')
|
|
||||||
else -- display_server == 'xorg'
|
|
||||||
os.execute('xclip -selection clipboard <<EOF\n' .. text .. '\nEOF\n')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function macos_set_clipboard(text)
|
|
||||||
os.execute('export LANG=en_US.UTF-8; cat <<EOF | pbcopy\n' .. text .. '\nEOF\n')
|
|
||||||
end
|
|
||||||
|
|
||||||
local function record_sub(_, text)
|
|
||||||
if text and mp.get_property_number('sub-start') and mp.get_property_number('sub-end') then
|
|
||||||
local sub_delay = mp.get_property_native("sub-delay")
|
|
||||||
local audio_delay = mp.get_property_native("audio-delay")
|
|
||||||
local newtext = clean(text)
|
|
||||||
if newtext == '' then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
subs[newtext] = { mp.get_property_number('sub-start') + sub_delay - audio_delay, mp.get_property_number('sub-end') + sub_delay - audio_delay }
|
|
||||||
dlog(string.format("%s -> %s : %s", subs[newtext][1], subs[newtext][2], newtext))
|
|
||||||
if ENABLE_SUBS_TO_CLIP then
|
|
||||||
-- Remove newlines from text before sending it to clipboard.
|
|
||||||
-- This way pressing control+v without copying from texthooker page
|
|
||||||
-- will always give last line.
|
|
||||||
text = string.gsub(text, "[\n\r]+", " ")
|
|
||||||
if platform == 'windows' then
|
|
||||||
if use_powershell_clipboard == nil then
|
|
||||||
determine_clip_type()
|
|
||||||
end
|
|
||||||
if use_powershell_clipboard then
|
|
||||||
powershell_set_clipboard(text)
|
|
||||||
else
|
|
||||||
cmd_set_clipboard(text)
|
|
||||||
end
|
|
||||||
elseif platform == 'macos' then
|
|
||||||
macos_set_clipboard(text)
|
|
||||||
else
|
|
||||||
linux_set_clipboard(text)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function create_audio(s, e)
|
|
||||||
|
|
||||||
if s == nil or e == nil then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local name = get_name(s, e)
|
|
||||||
local destination = utils.join_path(prefix, name .. '.mp3')
|
|
||||||
s = s - AUDIO_CLIP_PADDING
|
|
||||||
local t = e - s + AUDIO_CLIP_PADDING
|
|
||||||
local source = mp.get_property("path")
|
|
||||||
local aid = mp.get_property("aid")
|
|
||||||
|
|
||||||
local tracks_count = mp.get_property_number("track-list/count")
|
|
||||||
for i = 1, tracks_count do
|
|
||||||
local track_type = mp.get_property(string.format("track-list/%d/type", i))
|
|
||||||
local track_selected = mp.get_property(string.format("track-list/%d/selected", i))
|
|
||||||
if track_type == "audio" and track_selected == "yes" then
|
|
||||||
if mp.get_property(string.format("track-list/%d/external-filename", i), o) ~= o then
|
|
||||||
source = mp.get_property(string.format("track-list/%d/external-filename", i))
|
|
||||||
aid = 'auto'
|
|
||||||
end
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
local cmd = {
|
|
||||||
'run',
|
|
||||||
'mpv',
|
|
||||||
source,
|
|
||||||
'--loop-file=no',
|
|
||||||
'--video=no',
|
|
||||||
'--no-ocopy-metadata',
|
|
||||||
'--no-sub',
|
|
||||||
'--audio-channels=1',
|
|
||||||
string.format('--start=%.3f', s),
|
|
||||||
string.format('--length=%.3f', t),
|
|
||||||
string.format('--aid=%s', aid),
|
|
||||||
string.format('--volume=%s', USE_MPV_VOLUME and mp.get_property('volume') or '100'),
|
|
||||||
string.format("--af-append=afade=t=in:curve=ipar:st=%.3f:d=%.3f", s, AUDIO_CLIP_FADE),
|
|
||||||
string.format("--af-append=afade=t=out:curve=ipar:st=%.3f:d=%.3f", s + t - AUDIO_CLIP_FADE, AUDIO_CLIP_FADE),
|
|
||||||
string.format('-o=%s', destination)
|
|
||||||
}
|
|
||||||
mp.commandv(table.unpack(cmd))
|
|
||||||
dlog(utils.to_string(cmd))
|
|
||||||
end
|
|
||||||
|
|
||||||
local function create_screenshot(s, e)
|
|
||||||
local source = mp.get_property("path")
|
|
||||||
local img = utils.join_path(prefix, get_name(s,e) .. '.' .. IMAGE_FORMAT)
|
|
||||||
|
|
||||||
local cmd = {
|
|
||||||
'run',
|
|
||||||
'mpv',
|
|
||||||
source,
|
|
||||||
'--loop-file=no',
|
|
||||||
'--audio=no',
|
|
||||||
'--no-ocopy-metadata',
|
|
||||||
'--no-sub',
|
|
||||||
'--frames=1',
|
|
||||||
}
|
|
||||||
if IMAGE_FORMAT == 'webp' then
|
|
||||||
table.insert(cmd, '--ovc=libwebp')
|
|
||||||
table.insert(cmd, '--ovcopts-add=lossless=0')
|
|
||||||
table.insert(cmd, '--ovcopts-add=compression_level=6')
|
|
||||||
table.insert(cmd, '--ovcopts-add=preset=drawing')
|
|
||||||
elseif IMAGE_FORMAT == 'png' then
|
|
||||||
table.insert(cmd, '--vf-add=format=rgb24')
|
|
||||||
end
|
|
||||||
table.insert(cmd, '--vf-add=scale=480*iw*sar/ih:480')
|
|
||||||
table.insert(cmd, string.format('--start=%.3f', mp.get_property_number("time-pos")))
|
|
||||||
table.insert(cmd, string.format('-o=%s', img))
|
|
||||||
mp.commandv(table.unpack(cmd))
|
|
||||||
dlog(utils.to_string(cmd))
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
local function add_to_last_added(ifield, afield, tfield)
|
|
||||||
local added_notes = anki_connect('findNotes', {query='added:1'})["result"]
|
|
||||||
table.sort(added_notes)
|
|
||||||
local noteid = added_notes[#added_notes]
|
|
||||||
local note = anki_connect('notesInfo', {notes={noteid}})
|
|
||||||
|
|
||||||
if note ~= nil then
|
|
||||||
local word = note["result"][1]["fields"][FRONT_FIELD]["value"]
|
|
||||||
local new_fields = {
|
|
||||||
[SENTENCE_AUDIO_FIELD]=afield,
|
|
||||||
[SENTENCE_FIELD]=tfield,
|
|
||||||
[IMAGE_FIELD]=ifield
|
|
||||||
}
|
|
||||||
|
|
||||||
anki_connect('updateNoteFields', {
|
|
||||||
note={
|
|
||||||
id=noteid,
|
|
||||||
fields=new_fields
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
mp.osd_message("Updated note: " .. word, 3)
|
|
||||||
msg.info("Updated note: " .. word)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function get_extract()
|
|
||||||
local lines = get_clipboard()
|
|
||||||
local e = 0
|
|
||||||
local s = 0
|
|
||||||
for line in lines:gmatch("[^\r\n]+") do
|
|
||||||
line = clean(line)
|
|
||||||
dlog(line)
|
|
||||||
if subs[line]~= nil then
|
|
||||||
if subs[line][1] ~= nil and subs[line][2] ~= nil then
|
|
||||||
if s == 0 then
|
|
||||||
s = subs[line][1]
|
|
||||||
else
|
|
||||||
s = math.min(s, subs[line][1])
|
|
||||||
end
|
|
||||||
e = math.max(e, subs[line][2])
|
|
||||||
end
|
|
||||||
else
|
|
||||||
mp.osd_message("ERR! Line not found: " .. line, 3)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
dlog(string.format('s=%d, e=%d', s, e))
|
|
||||||
if e ~= 0 then
|
|
||||||
create_screenshot(s, e)
|
|
||||||
create_audio(s, e)
|
|
||||||
local ifield = '<img src='.. get_name(s,e) ..'.' .. IMAGE_FORMAT .. '>'
|
|
||||||
local afield = "[sound:".. get_name(s,e) .. ".mp3]"
|
|
||||||
local tfield = string.gsub(string.gsub(lines,"\n+", "<br />"), "\r", "")
|
|
||||||
add_to_last_added(ifield, afield, tfield)
|
|
||||||
if AUTOPLAY_AUDIO then
|
|
||||||
local name = get_name(s, e)
|
|
||||||
local audio = utils.join_path(prefix, name .. '.mp3')
|
|
||||||
local cmd = {'run', 'mpv', audio, '--loop-file=no', '--load-scripts=no'}
|
|
||||||
mp.commandv(table.unpack(cmd))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function ex()
|
|
||||||
|
|
||||||
if not prefix or prefix == "" then
|
|
||||||
set_media_dir()
|
|
||||||
end
|
|
||||||
|
|
||||||
if debug_mode then
|
|
||||||
get_extract()
|
|
||||||
else
|
|
||||||
pcall(get_extract)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function rec(...)
|
|
||||||
if debug_mode then
|
|
||||||
record_sub(...)
|
|
||||||
else
|
|
||||||
pcall(record_sub, ...)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function toggle_sub_to_clipboard()
|
|
||||||
ENABLE_SUBS_TO_CLIP = not ENABLE_SUBS_TO_CLIP
|
|
||||||
mp.osd_message("Clipboard inserter " .. (ENABLE_SUBS_TO_CLIP and "activated" or "deactived"), 3)
|
|
||||||
end
|
|
||||||
|
|
||||||
local function toggle_debug_mode()
|
|
||||||
debug_mode = not debug_mode
|
|
||||||
mp.osd_message("Debug mode " .. (debug_mode and "activated" or "deactived"), 3)
|
|
||||||
end
|
|
||||||
|
|
||||||
local function clear_subs(_)
|
|
||||||
subs = {}
|
|
||||||
end
|
|
||||||
|
|
||||||
mp.observe_property("sub-text", 'string', rec)
|
|
||||||
mp.observe_property("filename", "string", clear_subs)
|
|
||||||
|
|
||||||
mp.add_key_binding("ctrl+v", "update-anki-card", ex)
|
|
||||||
mp.add_key_binding("ctrl+t", "toggle-clipboard-insertion", toggle_sub_to_clipboard)
|
|
||||||
mp.add_key_binding("ctrl+d", "toggle-debug-mode", toggle_debug_mode)
|
|
||||||
mp.add_key_binding("ctrl+V", ex)
|
|
||||||
mp.add_key_binding("ctrl+T", toggle_sub_to_clipboard)
|
|
||||||
mp.add_key_binding("ctrl+D", toggle_debug_mode)
|
|
||||||
|
|
@ -21,3 +21,6 @@
|
||||||
|
|
||||||
|
|
||||||
@theme "~/.config/rofi/themes/KooL_style-4.rasi"
|
@theme "~/.config/rofi/themes/KooL_style-4.rasi"
|
||||||
|
@theme "~/.config/rofi/themes/KooL_style-4.rasi"
|
||||||
|
@theme "~/.config/rofi/themes/KooL_LonerOrZ.rasi"
|
||||||
|
@theme "~/.config/rofi/themes/KooL_style-1.rasi"
|
||||||
|
|
|
||||||
10
.vim/vimrc
10
.vim/vimrc
|
|
@ -99,7 +99,7 @@ Plug 'sjl/badwolf'
|
||||||
Plug 'sheerun/vim-polyglot'
|
Plug 'sheerun/vim-polyglot'
|
||||||
Plug 'Shougo/vimproc.vim', {'do' : 'make'}
|
Plug 'Shougo/vimproc.vim', {'do' : 'make'}
|
||||||
|
|
||||||
Plug 'Valloric/YouCompleteMe'
|
Plug 'Valloric/YouCompleteMe', {'do': './install.py --clangd-completer'}
|
||||||
|
|
||||||
Plug 'SirVer/ultisnips'
|
Plug 'SirVer/ultisnips'
|
||||||
Plug 'vimwiki/vimwiki'
|
Plug 'vimwiki/vimwiki'
|
||||||
|
|
@ -265,4 +265,10 @@ if ("/home/kappa/projects/working/galaksija-game-and-guide/igra" == projectroot)
|
||||||
nnoremap <leader>x <cmd>w<CR> <cmd>!make play<CR>
|
nnoremap <leader>x <cmd>w<CR> <cmd>!make play<CR>
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let g:vimwiki_list = [{'path': '~/docs/vimwiki/'}]
|
let g:vimwiki_list = [{'path': '~/docs/vimwiki/',
|
||||||
|
\ 'path_html': '~/Documents/html-vimwiki',
|
||||||
|
\ 'syntax': 'markdown', 'ext': 'md'}]
|
||||||
|
autocmd FileType vimwiki setlocal expandtab tabstop=2 shiftwidth=2 softtabstop=2
|
||||||
|
let vimwiki_global_ext = 0
|
||||||
|
nnoremap <Leader>T <CMD>VimwikiToggleListItem<CR>
|
||||||
|
nnoremap <Leader>wh <CMD>help vimwiki<CR>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue