54 Commits

Author SHA1 Message Date
14f5cca0d9 Add EasyEffects profile 2024-01-08 14:23:31 +01:00
660e3197ad Updates 2023-11-03 19:14:02 +01:00
f8643931f0 [NeoVim] Update to new hibiscus syntax 2023-09-28 14:32:58 +02:00
e2772e383c Updates 2023-09-28 13:53:07 +02:00
7e3ad70840 [NeoVim] add gopls 2023-09-28 12:36:31 +02:00
2e0102881c [NeoVim] Add FireNvim 2023-09-28 12:36:31 +02:00
b139567065 [Waybar] Fix pacman module (again) 2023-09-28 12:36:31 +02:00
1a60adb7e2 [NeoVim] Update and add noice 2023-09-28 12:36:31 +02:00
1b9be8f72a [Sway] Add border around kitty-scratches 2023-09-28 12:36:31 +02:00
cffbd4ec54 [Waybar] Fix pacman module 2023-09-28 12:36:31 +02:00
0d654d09fe [Waybar] Improve look 2023-09-28 12:36:31 +02:00
f3d849ba41 [Waybar] Add custom update manager 2023-09-28 12:36:31 +02:00
6e8d49ba6a [mpv] UOSC conf 2023-09-28 12:36:31 +02:00
15eaba2230 [Sway] Switch to waybar 2023-09-28 12:36:31 +02:00
e83a9c48b8 [PipeWire] Add noboost mic rules 2023-09-28 12:36:31 +02:00
f0300a5f79 [NeoVim] Add impatient 2023-09-28 12:36:31 +02:00
257f0d724f [NeoVim] Updates 2023-09-28 12:36:31 +02:00
efcc99d06d [NeoVim] Fix file open in neo-tree 2023-09-28 12:36:30 +02:00
6d9b419de7 [NeoVim] Small changes 2023-09-28 12:36:30 +02:00
65b26cb14d [NeoVim] Disable Hologram auto display 2023-09-28 12:36:30 +02:00
e4083640bd [NeoVim] Call PackerSync after Fennel changes 2023-09-28 12:36:30 +02:00
92608f2e4b [NeoVim] Display PNGs directly in floating windows 2023-09-28 12:36:30 +02:00
8b34da498c [NeoVim] Add Hologram 2023-09-28 12:36:30 +02:00
5b27c94972 [NeoVim] Slight syntax improvements 2023-09-28 12:36:30 +02:00
ec27ae8a22 [NeoVim] Open binary files with xdg-open 2023-09-28 12:36:30 +02:00
3501b0b633 [NeoVim] Fix tree-sitter bootstrap error 2023-09-28 12:36:30 +02:00
ad95308459 [NeoVim] Actually working bootstrap 2023-09-28 12:36:29 +02:00
db13710736 [NeoVim] Clean plugins settings 2023-09-28 12:36:29 +02:00
029f385a41 Small fixes 2023-09-28 12:36:29 +02:00
623b7fb584 [NeoVim] The world is now Fennel 2023-09-28 12:36:29 +02:00
3941e53268 [NeoVim] Fennel More 2023-09-28 12:36:29 +02:00
e3de89f2d5 [NeoTree] Handle vimtex QuickFix window 2023-09-28 12:36:28 +02:00
887d14a9d0 [NeoVim] More Fennel 2023-09-28 12:36:28 +02:00
65833eb514 [NeoVim] Starting the Fennel journey 2023-09-28 12:36:28 +02:00
ae6dfbff95 [NeoVim] Better LSP management 2023-09-28 12:36:28 +02:00
6b396ba033 [NeoVim] Packer Bootstrap 2023-09-28 12:36:28 +02:00
5d5f49d97f [NeoVim] Configure LTeX 2023-09-28 12:36:28 +02:00
8842455f4c [Ranger] Add dragon-drop shortcut 2023-09-28 12:34:49 +02:00
a5efbe744d [NeoVim] Add Mason 2023-09-28 12:34:49 +02:00
be84f20cc4 [NeoVim] Update cmp template 2023-09-28 12:34:49 +02:00
7cf820c3ff [i3status] Update configuration 2023-09-28 12:34:49 +02:00
7924ab3ed1 [NeoVim] LaTeX + Snippets 2023-09-28 12:34:48 +02:00
1d9f022627 [NeoVim] Add null-ls 2023-09-28 12:34:48 +02:00
985b58d41c [Sway] Resize status separator 2023-09-28 12:34:48 +02:00
ef3c12e4a2 Update some stuff from arachnidsGrip 2023-09-28 12:34:48 +02:00
755457b30e Make the world even more opaque 2023-09-28 12:34:48 +02:00
9677587aeb [NeoVim] Add diffview 2023-09-28 12:34:48 +02:00
96b1e2ecb1 Make the world opaque 2023-09-28 12:34:48 +02:00
dd98de48b2 [NeoVim] Remove neo-tree's fading 2023-09-28 12:34:48 +02:00
11659a506f Mess 2023-09-28 12:34:34 +02:00
1379bf56ab Updates 2021-01-27 13:35:20 +01:00
21f74a1108 Add systemd environment variables 2020-09-11 19:00:14 +02:00
369392c3b0 Mixed updates 2020-09-11 18:56:43 +02:00
468f2e1c0a Updates 2020-07-12 12:32:14 +02:00
81 changed files with 3417 additions and 973 deletions

2
.config/BetterDiscord/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
emote_data.json
logs.log

View File

@@ -44,8 +44,8 @@
"canary": {},
"ptb": {}
},
"version": "0.3.4",
"version": "0.3.5",
"emoteCacheDays": 7,
"emoteCacheDate": "2020-07-12T10:26:39.158Z",
"emoteCacheDate": "2020-10-24T10:21:17.385Z",
"bdcustomcss": "I2FwcC1tb3VudCAuY2hhdC0zYlJ4eHUgLm1lc3NhZ2VzV3JhcHBlci0zbFpEZlkgW2NsYXNzKj10aW1lc3RhbXBdLAojYXBwLW1vdW50IC5jaGF0LTNiUnh4dSAubWVzc2FnZXNXcmFwcGVyLTNsWkRmWSAubWVzc2FnZUNvbnRlbnQtMnFXV3hDLAojYXBwLW1vdW50IC5zaWRlYmFyLTJLOHBGaCAuY29udGFpbmVyLVBOa2ltYyAuY29udGFpbmVyRGVmYXVsdC0xWm5BRHEgLndyYXBwZXItMXVjalRkOm5vdCgubW9kZU11dGVkLTNvc3k3aik6bm90KC5tb2RlVW5yZWFkLTF6cEZkQSk6bm90KC5tb2RlU2VsZWN0ZWQtMXpBcEpfKSAuY29udGVudC0zYXRfQVUgLm5hbWUtM19Ec21nLAojYXBwLW1vdW50IC5zaWRlYmFyLTJLOHBGaCAuY29udGFpbmVyLVBOa2ltYyAuY29udGFpbmVyRGVmYXVsdC0xWm5BRHEgLndyYXBwZXItMXVjalRkOm5vdCgubW9kZU11dGVkLTNvc3k3aik6bm90KC5tb2RlVW5yZWFkLTF6cEZkQSk6bm90KC5tb2RlU2VsZWN0ZWQtMXpBcEpfKSAuY29udGVudC0zYXRfQVUgc3ZnLAojYXBwLW1vdW50IC5zaWRlYmFyLTJLOHBGaCAuY2hhbm5lbC0yUUQ5X08gewogICAgY29sb3I6ICM5M2ExYTEgIWltcG9ydGFudDsKfQoKI2FwcC1tb3VudCA6OnNlbGVjdGlvbiwKI2FwcC1tb3VudCAuY2hhdC0zYlJ4eHUgLm1lbnRpb24sCiNhcHAtbW91bnQgLm1lbWJlcnMtMTk5OHBCIC5tZW1iZXItMy1ZWFVlLnNlbGVjdGVkLWFYaFFSNiAucm9sZUNvbG9yLXJ6MnZNMCwKI2FwcC1tb3VudCAubWVtYmVycy0xOTk4cEIgLm1lbWJlci0zLVlYVWUgLmJvdFRhZy0yV1BKNzQsCiNhcHAtbW91bnQgLnNpZGViYXItMks4cEZoIC5jb250YWluZXItUE5raW1jIC5jb250YWluZXJEZWZhdWx0LTFabkFEcS5zZWxlY3RlZC0zN2pfaVUgLmNvbnRlbnQtM2F0X0FVIC5uYW1lLTNfRHNtZywKI2FwcC1tb3VudCAuc2lkZWJhci0ySzhwRmggLmNvbnRhaW5lci1QTmtpbWMgLmNvbnRhaW5lckRlZmF1bHQtMVpuQURxLnNlbGVjdGVkLTM3al9pVSAuY29udGVudC0zYXRfQVUgc3ZnLAojYXBwLW1vdW50IC50b29sdGlwQmxhY2stUFBHNDd6LCAjYXBwLW1vdW50IC50b29sdGlwQnJhbmQtZzAzTno4LCAjYXBwLW1vdW50IC50b29sdGlwUmVkLTgtOU5lUCwKI2FwcC1tb3VudCAuYnViYmxlLTN3ZTJkaSwgI2FwcC1tb3VudCAuc2lkZWJhci0ySzhwRmggLmNvbnRhaW5lci1QTmtpbWMgLmNvbnRhaW5lckRlZmF1bHQtMVpuQURxIC53cmFwcGVyLTF1Y2pUZDpub3QoLm1vZGVNdXRlZC0zb3N5N2opLm1vZGVVbnJlYWQtMXpwRmRBIC5jb250ZW50LTNhdF9BVSAubmFtZS0zX0RzbWcsCiNhcHAtbW91bnQgLnNpZGViYXItMks4cEZoIC5jb250YWluZXItUE5raW1jIC5jb250YWluZXJEZWZhdWx0LTFabkFEcSAud3JhcHBlci0xdWNqVGQ6bm90KC5tb2RlTXV0ZWQtM29zeTdqKS5tb2RlVW5yZWFkLTF6cEZkQSAuY29udGVudC0zYXRfQVUgc3ZnIHsKICAgIGNvbG9yOiAjMDAyYjM2ICFpbXBvcnRhbnQ7CiAgICB0ZXh0LXNoYWRvdzogbm9uZSAhaW1wb3J0YW50Owp9CgojYXBwLW1vdW50IC5zaWRlYmFyLTJLOHBGaCAuY29udGFpbmVyLVBOa2ltYyAuY29udGFpbmVyRGVmYXVsdC0xWm5BRHEgLndyYXBwZXItMXVjalRkOm5vdCgubW9kZU11dGVkLTNvc3k3aikubW9kZVVucmVhZC0xenBGZEEgLmNvbnRlbnQtM2F0X0FVIHsKICAgIGJhY2tncm91bmQ6ICMyNjhiZDIgIWltcG9ydGFudDsKfQoKI2FwcC1tb3VudCAuc2lkZWJhci0ySzhwRmggLmNoYW5uZWwtMlFEOV9PLnNlbGVjdGVkLWFYaFFSNiB7CiAgICBiYWNrZ3JvdW5kOiBsaW5lYXItZ3JhZGllbnQodmFyKC0tQkctZ3JhZGllbnQtZGlyZWN0aW9uKSwgcmdiYSh2YXIoLS1CRy1ncmFkaWVudC1vbmUpLCAxKSAyMCUsIHJnYmEodmFyKC0tQkctZ3JhZGllbnQtdHdvKSwgMSkpOwogICAgY29sb3I6ICMwMDJiMzYgIWltcG9ydGFudDsKICAgIHRleHQtc2hhZG93OiBub25lICFpbXBvcnRhbnQ7Cgp9"
}

View File

@@ -0,0 +1,3 @@
--enable-features=VaapiVideoDecoder,VaapiVideoEncoder,WebUIDarkMode
--ozone-platform=wayland
--force-dark-mode

View File

@@ -0,0 +1,243 @@
{
"output": {
"blocklist": [],
"equalizer#0": {
"balance": 0.0,
"bypass": false,
"input-gain": -9.3,
"left": {
"band0": {
"frequency": 19.952623149688797,
"gain": 4.000000000000001,
"mode": "RLC (BT)",
"mute": false,
"q": 1.0999999999999996,
"slope": "x1",
"solo": false,
"type": "Bell",
"width": 1.27
},
"band1": {
"frequency": 96.76334020503853,
"gain": -2.4999999999999893,
"mode": "RLC (BT)",
"mute": false,
"q": 0.6999999999999997,
"slope": "x1",
"solo": false,
"type": "Bell",
"width": 1.92
},
"band2": {
"frequency": 105.24354052777788,
"gain": 5.499999999999989,
"mode": "RLC (BT)",
"mute": false,
"q": 0.7099999999999997,
"slope": "x1",
"solo": false,
"type": "Lo-shelf",
"width": 1.89
},
"band3": {
"frequency": 214.92214271853953,
"gain": -1.7000000000000006,
"mode": "RLC (BT)",
"mute": false,
"q": 1.0999999999999996,
"slope": "x1",
"solo": false,
"type": "Bell",
"width": 1.27
},
"band4": {
"frequency": 1399.7170852629492,
"gain": -2.099999999999998,
"mode": "RLC (BT)",
"mute": false,
"q": 1.5047602375372453,
"slope": "x1",
"solo": false,
"type": "Bell",
"width": 0.94
},
"band5": {
"frequency": 2000.1851104970312,
"gain": 3.0,
"mode": "RLC (BT)",
"mute": false,
"q": 0.7099999999999997,
"slope": "x1",
"solo": false,
"type": "Hi-shelf",
"width": 1.89
},
"band6": {
"frequency": 2699.882756274361,
"gain": -1.3000000000000003,
"mode": "RLC (BT)",
"mute": false,
"q": 3.0000000000000013,
"slope": "x1",
"solo": false,
"type": "Bell",
"width": 0.48
},
"band7": {
"frequency": 3369.811843303749,
"gain": -3.900000000000002,
"mode": "RLC (BT)",
"mute": false,
"q": 2.500000000000001,
"slope": "x1",
"solo": false,
"type": "Bell",
"width": 0.57
},
"band8": {
"frequency": 5349.758767782307,
"gain": -3.4999999999999893,
"mode": "RLC (BT)",
"mute": false,
"q": 3.0000000000000013,
"slope": "x1",
"solo": false,
"type": "Bell",
"width": 0.48
},
"band9": {
"frequency": 10999.87233627273,
"gain": -4.0,
"mode": "RLC (BT)",
"mute": false,
"q": 0.7099999999999997,
"slope": "x1",
"solo": false,
"type": "Hi-shelf",
"width": 1.89
}
},
"mode": "IIR",
"num-bands": 10,
"output-gain": 9.0,
"pitch-left": 0.0,
"pitch-right": 0.0,
"right": {
"band0": {
"frequency": 19.952623149688797,
"gain": 4.000000000000001,
"mode": "RLC (BT)",
"mute": false,
"q": 1.0999999999999996,
"slope": "x1",
"solo": false,
"type": "Bell",
"width": 4.0
},
"band1": {
"frequency": 96.76334020503853,
"gain": -2.4999999999999893,
"mode": "RLC (BT)",
"mute": false,
"q": 0.6999999999999997,
"slope": "x1",
"solo": false,
"type": "Bell",
"width": 4.0
},
"band2": {
"frequency": 105.24354052777788,
"gain": 5.499999999999989,
"mode": "RLC (BT)",
"mute": false,
"q": 0.7099999999999997,
"slope": "x1",
"solo": false,
"type": "Lo-shelf",
"width": 4.0
},
"band3": {
"frequency": 214.92214271853953,
"gain": -1.7000000000000006,
"mode": "RLC (BT)",
"mute": false,
"q": 1.0999999999999996,
"slope": "x1",
"solo": false,
"type": "Bell",
"width": 4.0
},
"band4": {
"frequency": 1399.7170852629492,
"gain": -2.099999999999998,
"mode": "RLC (BT)",
"mute": false,
"q": 1.5047602375372453,
"slope": "x1",
"solo": false,
"type": "Bell",
"width": 4.0
},
"band5": {
"frequency": 2000.1851104970312,
"gain": 3.0,
"mode": "RLC (BT)",
"mute": false,
"q": 0.7099999999999997,
"slope": "x1",
"solo": false,
"type": "Hi-shelf",
"width": 4.0
},
"band6": {
"frequency": 2699.882756274361,
"gain": -1.3000000000000003,
"mode": "RLC (BT)",
"mute": false,
"q": 3.0000000000000013,
"slope": "x1",
"solo": false,
"type": "Bell",
"width": 4.0
},
"band7": {
"frequency": 3369.811843303749,
"gain": -3.900000000000002,
"mode": "RLC (BT)",
"mute": false,
"q": 2.500000000000001,
"slope": "x1",
"solo": false,
"type": "Bell",
"width": 4.0
},
"band8": {
"frequency": 5349.758767782307,
"gain": -3.4999999999999893,
"mode": "RLC (BT)",
"mute": false,
"q": 3.0000000000000013,
"slope": "x1",
"solo": false,
"type": "Bell",
"width": 4.0
},
"band9": {
"frequency": 10999.87233627273,
"gain": -4.0,
"mode": "RLC (BT)",
"mute": false,
"q": 0.7099999999999997,
"slope": "x1",
"solo": false,
"type": "Hi-shelf",
"width": 4.0
}
},
"split-channels": false
},
"plugins_order": [
"equalizer#0"
]
}
}

View File

@@ -0,0 +1,3 @@
--enable-features=VaapiVideoDecoder
--ozone-platform=wayland
--in-process-gpu

View File

@@ -0,0 +1,2 @@
export XDG_CURRENT_DESKTOP=sway
export XDG_SESSION_TYPE=wayland

2
.config/kitty/bell.sh Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/sh
find ~/.config/kitty/bells -type f | shuf -n 1 | mpv --audio-display=no --playlist=-

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -282,7 +282,8 @@ font_family DejaVuSansMono
#: windows in the tab and the window is not the currently focused
#: window
# command_on_bell none
# command_on_bell mpv --audio-display=no ~/loli.mp3
# command_on_bell ~/.config/kitty/bell.sh
#: Program to run when a bell occurs.
@@ -490,7 +491,7 @@ color15 #fdf6e3
#: The foreground and background colors
background_opacity 0.8
background_opacity 1.0
#: The opacity of the background. A number between 0 and 1, where 1 is
#: opaque and 0 is fully transparent. This will only work if
@@ -508,7 +509,7 @@ background_opacity 0.8
#: change transparency of windows set dynamic_background_opacity to
#: yes (this is off by default as it has a performance cost)
# dynamic_background_opacity no
dynamic_background_opacity yes
#: Allow changing of the background_opacity dynamically, using either
#: keyboard shortcuts (increase_background_opacity and
@@ -1034,6 +1035,8 @@ shell /bin/zsh
# map kitty_mod+a>1 set_background_opacity 1
# map kitty_mod+a>d set_background_opacity default
# map kitty_mod+delete clear_terminal reset active
map kitty_mod+a>o set_background_opacity 1.0
map kitty_mod+a>t set_background_opacity 0.8
#: You can create shortcuts to clear/reset the terminal. For example::

18
.config/mako/config Normal file
View File

@@ -0,0 +1,18 @@
anchor=top-left
background-color=#002b36ff
border-color=#859900ff
border-size=1
font=DejaVu Sans Mono 10
icon-location=left
margin=6
max-visible=-1
output=eDP-1
progress-color=source #859900ff
text-color=#93a1a1
text-alignment=left
width=400
[app-name="Spotify"]
anchor=top-right
icon-location=right
text-alignment=center

View File

@@ -1,3 +1,14 @@
ctrl+r cycle-values video-rotate 0 90 180 270
ctrl+b cycle deband
b cycle-values scale "bilinear" "spline64"; cycle-values dscale "bilinear" "mitchell"; cycle-values cscale "bilinear" "sinc"
ctrl+s sub-reload
S screenshot-to-file /tmp/mpv-screenshot.png ; run sh -c "cat /tmp/mpv-screenshot.png | wl-copy -t image/png"
x add sub-delay -0.04
X add sub-delay +0.04
# increase subtitle font size
ALT+k add sub-scale +0.1
# decrease subtitle font size
ALT+j add sub-scale -0.1

View File

@@ -1,14 +1,45 @@
profile=gpu-hq
gpu-api=vulkan
gpu-context=waylandvk
#gpu-api=vulkan
#gpu-context=waylandvk
gpu-context=wayland
hwdec=none
hdr-compute-peak=no
ao=jack
audio-channels=stereo
#ao=jack
#audio-channels=stereo
scale=spline64
dscale=mitchell
cscale=sinc
cscale-window=blackman
cscale-radius=3
deband=yes
screenshot-format=png
#Interpolation
#blend-subtitles=yes
#video-sync=display-resample
#interpolation=yes
#tscale=box
#tscale-window=sphinx
#tscale-radius=1.0
#tscale-clamp=0.0
sub-gray=yes # pour pas avoir des subs jaunes de merde
sub-gauss=0.7 # ça rend les subs un peu moins carrés, peut-être à adapter à vos envies
sub-font="Roboto Regular"
#sub-ass-vsfilter-aspect-compat=no
#sub-ass-vsfilter-blur-compat=no
prefetch-playlist=yes
rebase-start-time=no
ytdl-format=bestvideo[height<=?1080]+bestaudio/best
ytdl-raw-options="rm-cache-dir=:yes-playlist="
ytdl-format=bestvideo[height<=?1440]+bestaudio/best
#ytdl-raw-options="rm-cache-dir=:yes-playlist="
osd-fractions=yes
[downmix]
profile-desc="downmixing profile"
profile-cond=p["audio-params/channel-count"] > 2
ad-lavc-downmix=no
af=lavfi="pan=stereo|FL=0.707*FC+0.5*FL+0.5*BL+0.1*LFE|FR=0.707*FC+0.5*FR+0.5*BR+0.1*LFE"

1
.config/mpv/script-opts/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
japan7.conf

View File

@@ -0,0 +1 @@
auto=no

View File

@@ -0,0 +1,29 @@
# Socket path (leave empty for auto)
socket=
# Thumbnail path (leave empty for auto)
thumbnail=
# Maximum thumbnail size in pixels (scaled down to fit)
# Values are scaled when hidpi is enabled
max_height=200
max_width=200
# Overlay id
overlay_id=42
# Thumbnail interval in seconds set to 0 to disable (warning: high cpu usage)
interval=6
# Number of thumbnails
min_thumbnails=6
max_thumbnails=120
# Spawn thumbnailer on file load for faster initial thumbnails
spawn_first=no
# Enable on network playback
network=yes
# Enable on audio playback
audio=no

View File

@@ -0,0 +1,2 @@
timeline_size_max_fullscreen=40
top_bar_controls=no

View File

@@ -0,0 +1,329 @@
--[[
This script uses the lavfi cropdetect filter to automatically
insert a crop filter with appropriate parameters for the
currently playing video.
It will automatically crop the video, when playback starts.
Also It registers the key-binding "C" (shift+c). You can manually
crop the video by pressing the "C" (shift+c) key.
If the "C" key is pressed again, the crop filter is removed
restoring playback to its original state.
The workflow is as follows: First, it inserts the filter
vf=lavfi=cropdetect. After <detect_seconds> (default is 1)
seconds, it then inserts the filter vf=crop=w:h:x:y, where
w,h,x,y are determined from the vf-metadata gathered by
cropdetect. The cropdetect filter is removed immediately after
the crop filter is inserted as it is no longer needed.
Since the crop parameters are determined from the 1 second of
video between inserting the cropdetect and crop filters, the "C"
key should be pressed at a position in the video where the crop
region is unambiguous (i.e., not a black frame, black background
title card, or dark scene).
The default options can be overridden by adding
script-opts-append=autocrop-<parameter>=<value> into mpv.conf
List of available parameters (For default values, see <options>)
auto: bool - Whether to automatically apply crop at the start of
playback. If you don't want to crop automatically, set it to
false or add "script-opts-append=autocrop-auto=no" into
mpv.conf.
auto_delay: seconds - Delay before starting crop in auto mode.
You can try to increase this value to avoid dark scene or
fade in at beginning. Automatic cropping will not occur if
the value is larger than the remaining playback time.
detect_limit: number[0-255] - Black threshold for cropdetect.
Smaller values will generally result in less cropping.
See limit of https://ffmpeg.org/ffmpeg-filters.html#cropdetect
detect_round: number[2^n] - The value which the width/height
should be divisible by. Smaller values have better detection
accuracy. If you have problems with other filters,
you can try to set it to 4 or 16.
See round of https://ffmpeg.org/ffmpeg-filters.html#cropdetect
detect_min_ratio: number[0.0-1.0] - The ratio of the minimum clip
size to the original. If the picture is over cropped or under
cropped, try adjusting this value.
detect_seconds: seconds - How long to gather cropdetect data.
Increasing this may be desirable to allow cropdetect more
time to collect data.
suppress_osd: bool - Whether the OSD shouldn't be used when filters
are applied and removed.
--]]
require "mp.msg"
require 'mp.options'
local options = {
auto = true,
auto_delay = 4,
detect_limit = "24/255",
detect_round = 2,
detect_min_ratio = 0.5,
detect_seconds = 1,
suppress_osd = false,
}
read_options(options)
local label_prefix = mp.get_script_name()
local labels = {
crop = string.format("%s-crop", label_prefix),
cropdetect = string.format("%s-cropdetect", label_prefix)
}
timers = {
auto_delay = nil,
detect_crop = nil
}
local command_prefix = options.suppress_osd and 'no-osd' or ''
function is_filter_present(label)
local filters = mp.get_property_native("vf")
for index, filter in pairs(filters) do
if filter["label"] == label then
return true
end
end
return false
end
function is_enough_time(seconds)
-- Plus 1 second for deviation.
local time_needed = seconds + 1
local playtime_remaining = mp.get_property_native("playtime-remaining")
return playtime_remaining and time_needed < playtime_remaining
end
function is_cropable()
for _, track in pairs(mp.get_property_native('track-list')) do
if track.type == 'video' and track.selected then
return not track.albumart
end
end
return false
end
function remove_filter(label)
if is_filter_present(label) then
mp.command(string.format('%s vf remove @%s', command_prefix, label))
return true
end
return false
end
function cleanup()
-- Remove all existing filters.
for key, value in pairs(labels) do
remove_filter(value)
end
-- Kill all timers.
for index, timer in pairs(timers) do
if timer then
timer:kill()
timer = nil
end
end
end
function detect_crop()
-- If it's not cropable, exit.
if not is_cropable() then
mp.msg.warn("autocrop only works for videos.")
return
end
-- Verify if there is enough time to detect crop.
local time_needed = options.detect_seconds
if not is_enough_time(time_needed) then
mp.msg.warn("Not enough time to detect crop.")
return
end
-- Insert the cropdetect filter.
local limit = options.detect_limit
local round = options.detect_round
mp.command(
string.format(
'%s vf pre @%s:cropdetect=limit=%s:round=%d:reset=0',
command_prefix, labels.cropdetect, limit, round
)
)
-- Wait to gather data.
timers.detect_crop = mp.add_timeout(time_needed, detect_end)
end
function detect_end()
-- Get the metadata and remove the cropdetect filter.
local cropdetect_metadata =
mp.get_property_native(
string.format("vf-metadata/%s",
labels.cropdetect
)
)
remove_filter(labels.cropdetect)
-- Remove the timer of detect crop.
if timers.detect_crop then
timers.detect_crop:kill()
timers.detect_crop = nil
end
local meta = {}
-- Verify the existence of metadata.
if cropdetect_metadata then
meta = {
w = cropdetect_metadata["lavfi.cropdetect.w"],
h = cropdetect_metadata["lavfi.cropdetect.h"],
x = cropdetect_metadata["lavfi.cropdetect.x"],
y = cropdetect_metadata["lavfi.cropdetect.y"],
}
else
mp.msg.error("No crop data.")
mp.msg.info("Was the cropdetect filter successfully inserted?")
mp.msg.info("Does your version of ffmpeg/libav support AVFrame metadata?")
return
end
-- Verify that the metadata meets the requirements and convert it.
if meta.w and meta.h and meta.x and meta.y then
local width = mp.get_property_native("width")
local height = mp.get_property_native("height")
meta = {
w = tonumber(meta.w),
h = tonumber(meta.h),
x = tonumber(meta.x),
y = tonumber(meta.y),
min_w = width * options.detect_min_ratio,
min_h = height * options.detect_min_ratio,
max_w = width,
max_h = height
}
else
mp.msg.error("Got empty crop data.")
mp.msg.info("You might need to increase detect_seconds.")
return
end
apply_crop(meta)
end
function apply_crop(meta)
-- Verify if it is necessary to crop.
local is_effective = meta.x > 0 or meta.y > 0
or meta.w < meta.max_w or meta.h < meta.max_h
if not is_effective then
mp.msg.info("No area detected for cropping.")
return
end
-- Verify it is not over cropped.
local is_excessive = meta.w < meta.min_w and meta.h < meta.min_h
if is_excessive then
mp.msg.info("The area to be cropped is too large.")
mp.msg.info("You might need to decrease detect_min_ratio.")
return
end
-- Remove existing crop.
remove_filter(labels.crop)
-- Apply crop.
mp.command(
string.format("%s vf pre @%s:lavfi-crop=w=%s:h=%s:x=%s:y=%s",
command_prefix, labels.crop, meta.w, meta.h, meta.x, meta.y
)
)
end
function on_start()
-- Clean up at the beginning.
cleanup()
-- If auto is not true, exit.
if not options.auto then
return
end
-- If it is the beginning, wait for detect_crop
-- after auto_delay seconds, otherwise immediately.
local playback_time = mp.get_property_native("playback-time")
local is_delay_needed = playback_time
and options.auto_delay > playback_time
if is_delay_needed then
-- Verify if there is enough time for autocrop.
local time_needed = options.auto_delay + options.detect_seconds
if not is_enough_time(time_needed) then
mp.msg.warn("Not enough time for autocrop.")
return
end
timers.auto_delay = mp.add_timeout(time_needed,
function()
detect_crop()
-- Remove the timer of auto delay.
timers.auto_delay:kill()
timers.auto_delay = nil
end
)
else
detect_crop()
end
end
function on_toggle()
-- If it is during auto_delay, kill the timer.
if timers.auto_delay then
timers.auto_delay:kill()
timers.auto_delay = nil
end
-- Cropped => Remove it.
if remove_filter(labels.crop) then
return
end
-- Detecting => Leave it.
if timers.detect_crop then
mp.msg.warn("Already cropdetecting!")
return
end
-- Neither => Do delectcrop.
detect_crop()
end
mp.add_key_binding("C", "toggle_crop", on_toggle)
mp.register_event("end-file", cleanup)
mp.register_event("file-loaded", on_start)

View File

@@ -0,0 +1,35 @@
local settings = {
username = "",
password = "",
projo_host = ""
}
local opts = require 'mp.options'
opts.read_options(settings, "japan7")
local function is_projo(path)
return path:match("^https://projection")
end
function on_load()
local path = mp.get_property("path")
local match = path:gsub("^https://fubuki.aidoru.agency", "https://"..settings.username..":"..settings.password.."@fubuki.aidoru.agency")
match = match:gsub("^https://korone.aidoru.agency", "https://"..settings.username..":"..settings.password.."@korone.aidoru.agency")
match = match:gsub("^https://yuyuko.butaishoujo.moe", "https://"..settings.username..":"..settings.password.."@yuyuko.butaishoujo.moe")
match = match:gsub("^https://projo.yuru.moe", "https://"..settings.username..":"..settings.password.."@projo.yuru.moe")
match = match:gsub("^https://gungnir.dato.moe", "https://"..settings.username..":"..settings.password.."@gungnir.dato.moe")
match = match:gsub("^https://projection", settings.projo_host)
if match ~= path then
if is_projo(path) then
local stream = match:gsub("^(.+)/.-$", "%1/stream")
mp.set_property("ordered-chapters-files", stream)
end
mp.set_property("stream-open-filename", match)
local ass = match:gsub("...$", "ass")
mp.commandv("sub-add", ass)
end
end
mp.register_event('start-file', on_load)

View File

@@ -1,675 +0,0 @@
-- repl.lua -- A graphical REPL for mpv input commands
--
-- © 2016, James Ross-Gowan
--
-- Permission to use, copy, modify, and/or distribute this software for any
-- purpose with or without fee is hereby granted, provided that the above
-- copyright notice and this permission notice appear in all copies.
--
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
-- SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
-- OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
-- CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
local utils = require 'mp.utils'
local options = require 'mp.options'
local assdraw = require 'mp.assdraw'
-- Default options
local opts = {
-- All drawing is scaled by this value, including the text borders and the
-- cursor. Change it if you have a high-DPI display.
scale = 1,
-- Set the font used for the REPL and the console. This probably doesn't
-- have to be a monospaced font.
font = 'monospace',
-- Set the font size used for the REPL and the console. This will be
-- multiplied by "scale."
['font-size'] = 16,
}
function detect_platform()
local o = {}
-- Kind of a dumb way of detecting the platform but whatever
if mp.get_property_native('options/vo-mmcss-profile', o) ~= o then
return 'windows'
elseif mp.get_property_native('options/cocoa-force-dedicated-gpu', o) ~= o then
return 'macos'
end
return 'linux'
end
-- Pick a better default font for Windows and macOS
local platform = detect_platform()
if platform == 'windows' then
opts.font = 'Consolas'
elseif platform == 'macos' then
opts.font = 'Menlo'
end
-- Apply user-set options
options.read_options(opts)
-- Build a list of commands, properties and options for tab-completion
local option_info = {
'name', 'type', 'set-from-commandline', 'set-locally', 'default-value',
'min', 'max', 'choices',
}
local cmd_list = {
'ignore', 'seek', 'revert-seek', 'quit', 'quit-watch-later', 'stop',
'frame-step', 'frame-back-step', 'playlist-next', 'playlist-prev',
'playlist-shuffle', 'sub-step', 'sub-seek', 'osd', 'print-text',
'show-text', 'show-progress', 'sub-add', 'sub-remove', 'sub-reload',
'tv-last-channel', 'screenshot', 'screenshot-to-file', 'screenshot-raw',
'loadfile', 'loadlist', 'playlist-clear', 'playlist-remove',
'playlist-move', 'run', 'set', 'add', 'cycle', 'multiply', 'cycle-values',
'enable-section', 'disable-section', 'define-section', 'ab-loop',
'drop-buffers', 'af', 'af-command', 'ao-reload', 'vf', 'vf-command',
'script-binding', 'script-message', 'script-message-to', 'overlay-add',
'overlay-remove', 'write-watch-later-config', 'hook-add', 'hook-ack',
'mouse', 'keypress', 'keydown', 'keyup', 'audio-add', 'audio-remove',
'audio-reload', 'rescan-external-file', 'apply-profile', 'load-script',
}
local prop_list = mp.get_property_native('property-list')
for _, opt in ipairs(mp.get_property_native('options')) do
prop_list[#prop_list + 1] = 'options/' .. opt
prop_list[#prop_list + 1] = 'file-local-options/' .. opt
prop_list[#prop_list + 1] = 'option-info/' .. opt
for _, p in ipairs(option_info) do
prop_list[#prop_list + 1] = 'option-info/' .. opt .. '/' .. p
end
end
local repl_active = false
local insert_mode = false
local line = ''
local cursor = 1
local history = {}
local history_pos = 1
local log_ring = {}
-- Add a line to the log buffer (which is limited to 100 lines)
function log_add(style, text)
log_ring[#log_ring + 1] = { style = style, text = text }
if #log_ring > 100 then
table.remove(log_ring, 1)
end
end
-- Escape a string for verbatim display on the OSD
function ass_escape(str)
-- There is no escape for '\' in ASS (I think?) but '\' is used verbatim if
-- it isn't followed by a recognised character, so add a zero-width
-- non-breaking space
str = str:gsub('\\', '\\\239\187\191')
str = str:gsub('{', '\\{')
str = str:gsub('}', '\\}')
-- Precede newlines with a ZWNBSP to prevent ASS's weird collapsing of
-- consecutive newlines
str = str:gsub('\n', '\239\187\191\\N')
return str
end
-- Render the REPL and console as an ASS OSD
function update()
local screenx, screeny, aspect = mp.get_osd_size()
screenx = screenx / opts.scale
screeny = screeny / opts.scale
-- Clear the OSD if the REPL is not active
if not repl_active then
mp.set_osd_ass(screenx, screeny, '')
return
end
local ass = assdraw.ass_new()
local style = '{\\r' ..
'\\1a&H00&\\3a&H00&\\4a&H99&' ..
'\\1c&Heeeeee&\\3c&H111111&\\4c&H000000&' ..
'\\fn' .. opts.font .. '\\fs' .. opts['font-size'] ..
'\\bord2\\xshad0\\yshad1\\fsp0\\q1}'
-- Create the cursor glyph as an ASS drawing. ASS will draw the cursor
-- inline with the surrounding text, but it sets the advance to the width
-- of the drawing. So the cursor doesn't affect layout too much, make it as
-- thin as possible and make it appear to be 1px wide by giving it 0.5px
-- horizontal borders.
local cheight = opts['font-size'] * 8
local cglyph = '{\\r' ..
'\\1a&H44&\\3a&H44&\\4a&H99&' ..
'\\1c&Heeeeee&\\3c&Heeeeee&\\4c&H000000&' ..
'\\xbord0.5\\ybord0\\xshad0\\yshad1\\p4\\pbo24}' ..
'm 0 0 l 1 0 l 1 ' .. cheight .. ' l 0 ' .. cheight ..
'{\\p0}'
local before_cur = ass_escape(line:sub(1, cursor - 1))
local after_cur = ass_escape(line:sub(cursor))
-- Render log messages as ASS. This will render at most screeny / font-size
-- messages.
local log_ass = ''
local log_messages = #log_ring
local log_max_lines = math.ceil(screeny / opts['font-size'])
if log_max_lines < log_messages then
log_messages = log_max_lines
end
for i = #log_ring - log_messages + 1, #log_ring do
log_ass = log_ass .. style .. log_ring[i].style .. ass_escape(log_ring[i].text)
end
ass:new_event()
ass:an(1)
ass:pos(2, screeny - 2)
ass:append(log_ass .. '\\N')
ass:append(style .. '> ' .. before_cur)
ass:append(cglyph)
ass:append(style .. after_cur)
-- Redraw the cursor with the REPL text invisible. This will make the
-- cursor appear in front of the text.
ass:new_event()
ass:an(1)
ass:pos(2, screeny - 2)
ass:append(style .. '{\\alpha&HFF&}> ' .. before_cur)
ass:append(cglyph)
ass:append(style .. '{\\alpha&HFF&}' .. after_cur)
mp.set_osd_ass(screenx, screeny, ass.text)
end
-- Set the REPL visibility (`, Esc)
function set_active(active)
if active == repl_active then return end
if active then
repl_active = true
insert_mode = false
mp.enable_key_bindings('repl-input', 'allow-hide-cursor+allow-vo-dragging')
else
repl_active = false
mp.disable_key_bindings('repl-input')
end
update()
end
-- Show the repl if hidden and replace its contents with 'text'
-- (script-message-to repl type)
function show_and_type(text)
text = text or ''
-- Save the line currently being edited, just in case
if line ~= text and line ~= '' and history[#history] ~= line then
history[#history + 1] = line
end
line = text
cursor = line:len() + 1
history_pos = #history + 1
insert_mode = false
if repl_active then
update()
else
set_active(true)
end
end
-- Naive helper function to find the next UTF-8 character in 'str' after 'pos'
-- by skipping continuation bytes. Assumes 'str' contains valid UTF-8.
function next_utf8(str, pos)
if pos > str:len() then return pos end
repeat
pos = pos + 1
until pos > str:len() or str:byte(pos) < 0x80 or str:byte(pos) > 0xbf
return pos
end
-- As above, but finds the previous UTF-8 charcter in 'str' before 'pos'
function prev_utf8(str, pos)
if pos <= 1 then return pos end
repeat
pos = pos - 1
until pos <= 1 or str:byte(pos) < 0x80 or str:byte(pos) > 0xbf
return pos
end
-- Insert a character at the current cursor position (' '-'~', Shift+Enter)
function handle_char_input(c)
if insert_mode then
line = line:sub(1, cursor - 1) .. c .. line:sub(next_utf8(line, cursor))
else
line = line:sub(1, cursor - 1) .. c .. line:sub(cursor)
end
cursor = cursor + 1
update()
end
-- Remove the character behind the cursor (Backspace)
function handle_backspace()
if cursor <= 1 then return end
local prev = prev_utf8(line, cursor)
line = line:sub(1, prev - 1) .. line:sub(cursor)
cursor = prev
update()
end
-- Remove the character in front of the cursor (Del)
function handle_del()
if cursor > line:len() then return end
line = line:sub(1, cursor - 1) .. line:sub(next_utf8(line, cursor))
update()
end
-- Toggle insert mode (Ins)
function handle_ins()
insert_mode = not insert_mode
end
-- Move the cursor to the next character (Right)
function next_char(amount)
cursor = next_utf8(line, cursor)
update()
end
-- Move the cursor to the previous character (Left)
function prev_char(amount)
cursor = prev_utf8(line, cursor)
update()
end
-- Clear the current line (Ctrl+C)
function clear()
line = ''
cursor = 1
insert_mode = false
history_pos = #history + 1
update()
end
-- Close the REPL if the current line is empty, otherwise do nothing (Ctrl+D)
function maybe_exit()
if line == '' then
set_active(false)
end
end
-- Run the current command and clear the line (Enter)
function handle_enter()
if line == '' then
return
end
if history[#history] ~= line then
history[#history + 1] = line
end
mp.command(line)
clear()
end
-- Go to the specified position in the command history
function go_history(new_pos)
local old_pos = history_pos
history_pos = new_pos
-- Restrict the position to a legal value
if history_pos > #history + 1 then
history_pos = #history + 1
elseif history_pos < 1 then
history_pos = 1
end
-- Do nothing if the history position didn't actually change
if history_pos == old_pos then
return
end
-- If the user was editing a non-history line, save it as the last history
-- entry. This makes it much less frustrating to accidentally hit Up/Down
-- while editing a line.
if old_pos == #history + 1 and line ~= '' and history[#history] ~= line then
history[#history + 1] = line
end
-- Now show the history line (or a blank line for #history + 1)
if history_pos <= #history then
line = history[history_pos]
else
line = ''
end
cursor = line:len() + 1
insert_mode = false
update()
end
-- Go to the specified relative position in the command history (Up, Down)
function move_history(amount)
go_history(history_pos + amount)
end
-- Go to the first command in the command history (PgUp)
function handle_pgup()
go_history(1)
end
-- Stop browsing history and start editing a blank line (PgDown)
function handle_pgdown()
go_history(#history + 1)
end
-- Move to the start of the current word, or if already at the start, the start
-- of the previous word. (Ctrl+Left)
function prev_word()
-- This is basically the same as next_word() but backwards, so reverse the
-- string in order to do a "backwards" find. This wouldn't be as annoying
-- to do if Lua didn't insist on 1-based indexing.
cursor = line:len() - select(2, line:reverse():find('%s*[^%s]*', line:len() - cursor + 2)) + 1
update()
end
-- Move to the end of the current word, or if already at the end, the end of
-- the next word. (Ctrl+Right)
function next_word()
cursor = select(2, line:find('%s*[^%s]*', cursor)) + 1
update()
end
-- List of tab-completions:
-- pattern: A Lua pattern used in string:find. Should return the start and
-- end positions of the word to be completed in the first and second
-- capture groups (using the empty parenthesis notation "()")
-- list: A list of candidate completion values.
-- append: An extra string to be appended to the end of a successful
-- completion. It is only appended if 'list' contains exactly one
-- match.
local completers = {
{ pattern = '^%s*()[%w_-]+()$', list = cmd_list, append = ' ' },
{ pattern = '^%s*set%s+()[%w_/-]+()$', list = prop_list, append = ' ' },
{ pattern = '^%s*set%s+"()[%w_/-]+()$', list = prop_list, append = '" ' },
{ pattern = '^%s*add%s+()[%w_/-]+()$', list = prop_list, append = ' ' },
{ pattern = '^%s*add%s+"()[%w_/-]+()$', list = prop_list, append = '" ' },
{ pattern = '^%s*cycle%s+()[%w_/-]+()$', list = prop_list, append = ' ' },
{ pattern = '^%s*cycle%s+"()[%w_/-]+()$', list = prop_list, append = '" ' },
{ pattern = '^%s*multiply%s+()[%w_/-]+()$', list = prop_list, append = ' ' },
{ pattern = '^%s*multiply%s+"()[%w_/-]+()$', list = prop_list, append = '" ' },
{ pattern = '${()[%w_/-]+()$', list = prop_list, append = '}' },
}
-- Use 'list' to find possible tab-completions for 'part.' Returns the longest
-- common prefix of all the matching list items and a flag that indicates
-- whether the match was unique or not.
function complete_match(part, list)
local completion = nil
local full_match = false
for _, candidate in ipairs(list) do
if candidate:sub(1, part:len()) == part then
if completion and completion ~= candidate then
local prefix_len = part:len()
while completion:sub(1, prefix_len + 1)
== candidate:sub(1, prefix_len + 1) do
prefix_len = prefix_len + 1
end
completion = candidate:sub(1, prefix_len)
full_match = false
else
completion = candidate
full_match = true
end
end
end
return completion, full_match
end
-- Complete the option or property at the cursor (TAB)
function complete()
local before_cur = line:sub(1, cursor - 1)
local after_cur = line:sub(cursor)
-- Try the first completer that works
for _, completer in ipairs(completers) do
-- Completer patterns should return the start and end of the word to be
-- completed as the first and second capture groups
local _, _, s, e = before_cur:find(completer.pattern)
if not s then
-- Multiple input commands can be separated by semicolons, so all
-- completions that are anchored at the start of the string with
-- '^' can start from a semicolon as well. Replace ^ with ; and try
-- to match again.
_, _, s, e = before_cur:find(completer.pattern:gsub('^^', ';'))
end
if s then
-- If the completer's pattern found a word, check the completer's
-- list for possible completions
local part = before_cur:sub(s, e)
local c, full = complete_match(part, completer.list)
if c then
-- If there was only one full match from the list, add
-- completer.append to the final string. This is normally a
-- space or a quotation mark followed by a space.
if full and completer.append then
c = c .. completer.append
end
-- Insert the completion and update
before_cur = before_cur:sub(1, s - 1) .. c
cursor = before_cur:len() + 1
line = before_cur .. after_cur
update()
return
end
end
end
end
-- Move the cursor to the beginning of the line (HOME)
function go_home()
cursor = 1
update()
end
-- Move the cursor to the end of the line (END)
function go_end()
cursor = line:len() + 1
update()
end
-- Delete from the cursor to the end of the word (Ctrl+W)
function del_word()
local before_cur = line:sub(1, cursor - 1)
local after_cur = line:sub(cursor)
before_cur = before_cur:gsub('[^%s]+%s*$', '', 1)
line = before_cur .. after_cur
cursor = before_cur:len() + 1
update()
end
-- Delete from the cursor to the end of the line (Ctrl+K)
function del_to_eol()
line = line:sub(1, cursor - 1)
update()
end
-- Delete from the cursor back to the start of the line (Ctrl+U)
function del_to_start()
line = line:sub(cursor)
cursor = 1
update()
end
-- Empty the log buffer of all messages (Ctrl+L)
function clear_log_buffer()
log_ring = {}
update()
end
-- Returns a string of UTF-8 text from the clipboard (or the primary selection)
function get_clipboard(clip)
if platform == 'linux' then
local res = utils.subprocess({
args = { 'xclip', '-selection', clip and 'clipboard' or 'primary', '-out' },
playback_only = false,
})
if not res.error then
return res.stdout
end
elseif platform == 'windows' then
local res = utils.subprocess({
args = { 'powershell', '-NoProfile', '-Command', [[& {
Trap {
Write-Error -ErrorRecord $_
Exit 1
}
$clip = ""
if (Get-Command "Get-Clipboard" -errorAction SilentlyContinue) {
$clip = Get-Clipboard -Raw -Format Text -TextFormatType UnicodeText
} else {
Add-Type -AssemblyName PresentationCore
$clip = [Windows.Clipboard]::GetText()
}
$clip = $clip -Replace "`r",""
$u8clip = [System.Text.Encoding]::UTF8.GetBytes($clip)
[Console]::OpenStandardOutput().Write($u8clip, 0, $u8clip.Length)
}]] },
playback_only = false,
})
if not res.error then
return res.stdout
end
elseif platform == 'macos' then
local res = utils.subprocess({
args = { 'pbpaste' },
playback_only = false,
})
if not res.error then
return res.stdout
end
end
return ''
end
-- Paste text from the window-system's clipboard. 'clip' determines whether the
-- clipboard or the primary selection buffer is used (on X11 only.)
function paste(clip)
local text = get_clipboard(clip)
local before_cur = line:sub(1, cursor - 1)
local after_cur = line:sub(cursor)
line = before_cur .. text .. after_cur
cursor = cursor + text:len()
update()
end
-- The REPL has pretty specific requirements for key bindings that aren't
-- really satisified by any of mpv's helper methods, since they must be in
-- their own input section, but they must also raise events on key-repeat.
-- Hence, this function manually creates an input section and puts a list of
-- bindings in it.
function add_repl_bindings(bindings)
local cfg = ''
for i, binding in ipairs(bindings) do
local key = binding[1]
local fn = binding[2]
local name = '__repl_binding_' .. i
mp.add_key_binding(nil, name, fn, 'repeatable')
cfg = cfg .. key .. ' script-binding ' .. mp.script_name .. '/' ..
name .. '\n'
end
mp.commandv('define-section', 'repl-input', cfg, 'force')
end
-- Mapping from characters to mpv key names
local binding_name_map = {
[' '] = 'SPACE',
['#'] = 'SHARP',
}
-- List of input bindings. This is a weird mashup between common GUI text-input
-- bindings and readline bindings.
local bindings = {
{ 'esc', function() set_active(false) end },
{ 'enter', handle_enter },
{ 'shift+enter', function() handle_char_input('\n') end },
{ 'bs', handle_backspace },
{ 'shift+bs', handle_backspace },
{ 'del', handle_del },
{ 'shift+del', handle_del },
{ 'ins', handle_ins },
{ 'shift+ins', function() paste(false) end },
{ 'mouse_btn1', function() paste(false) end },
{ 'left', function() prev_char() end },
{ 'right', function() next_char() end },
{ 'up', function() move_history(-1) end },
{ 'axis_up', function() move_history(-1) end },
{ 'mouse_btn3', function() move_history(-1) end },
{ 'down', function() move_history(1) end },
{ 'axis_down', function() move_history(1) end },
{ 'mouse_btn4', function() move_history(1) end },
{ 'axis_left', function() end },
{ 'axis_right', function() end },
{ 'ctrl+left', prev_word },
{ 'ctrl+right', next_word },
{ 'tab', complete },
{ 'home', go_home },
{ 'end', go_end },
{ 'pgup', handle_pgup },
{ 'pgdwn', handle_pgdown },
{ 'ctrl+c', clear },
{ 'ctrl+d', maybe_exit },
{ 'ctrl+k', del_to_eol },
{ 'ctrl+l', clear_log_buffer },
{ 'ctrl+u', del_to_start },
{ 'ctrl+v', function() paste(true) end },
{ 'meta+v', function() paste(true) end },
{ 'ctrl+w', del_word },
}
-- Add bindings for all the printable US-ASCII characters from ' ' to '~'
-- inclusive. Note, this is a pretty hacky way to do text input. mpv's input
-- system was designed for single-key key bindings rather than text input, so
-- things like dead-keys and non-ASCII input won't work. This is probably okay
-- though, since all mpv's commands and properties can be represented in ASCII.
for b = (' '):byte(), ('~'):byte() do
local c = string.char(b)
local binding = binding_name_map[c] or c
bindings[#bindings + 1] = {binding, function() handle_char_input(c) end}
end
add_repl_bindings(bindings)
-- Add a global binding for enabling the REPL. While it's enabled, its bindings
-- will take over and it can be closed with ESC.
mp.add_key_binding('œ', 'repl-enable', function()
set_active(true)
end)
-- Add a script-message to show the REPL and fill it with the provided text
mp.register_script_message('type', function(text)
show_and_type(text)
end)
-- Redraw the REPL when the OSD size changes. This is needed because the
-- PlayRes of the OSD will need to be adjusted.
mp.observe_property('osd-width', 'native', update)
mp.observe_property('osd-height', 'native', update)
-- Watch for log-messages and print them in the REPL console
mp.enable_messages('info')
mp.register_event('log-message', function(e)
-- Ignore log messages from the OSD because of paranoia, since writing them
-- to the OSD could generate more messages in an infinite loop.
if e.prefix:sub(1, 3) == 'osd' then return end
-- Use color for warn/error/fatal messages. Colors are stolen from base16
-- Eighties by Chris Kempson.
local style = ''
if e.level == 'warn' then
style = '{\\1c&H66ccff&}'
elseif e.level == 'error' then
style = '{\\1c&H7a77f2&}'
elseif e.level == 'fatal' then
style = '{\\1c&H5791f9&\\b1}'
end
log_add(style, '[' .. e.prefix .. '] ' .. e.text)
update()
end)

4
.config/nvim/.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
lua/**
plugin/packer_compiled.lua
**.spl

8
.config/nvim/.luarc.json Normal file
View File

@@ -0,0 +1,8 @@
{
"$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json",
"Lua.diagnostics.globals": [
"vim",
"use",
"packer_bootstrap"
]
}

View File

@@ -1,59 +0,0 @@
{
"explorer.keyMappings": {
"k": "nodePrev",
"j": "nodeNext",
"*": "toggleSelection",
"<tab>": "actionMenu",
"<Left>": "collapse",
"<Right>": "expand",
"J": ["toggleSelection", "normal:j"],
"K": ["toggleSelection", "normal:k"],
"gl": "expandRecursive",
"gh": "collapseRecursive",
"o": "expandOrCollapse",
"<cr>": "open",
"e": "open",
"E": "openInVsplit",
"t": "openInTab",
"<bs>": "gotoParent",
"y": "copyFilepath",
"Y": "copyFilename",
"c": "copyFile",
"x": "cutFile",
"p": "pasteFile",
"d": "delete",
"D": "deleteForever",
"a": "addFile",
"A": "addDirectory",
"r": "rename",
".": "toggleHidden",
"R": "refresh",
"?": "help",
"q": "quit",
"X": "systemExecute",
"gd": "listDrive",
"f": "search",
"F": "searchRecursive",
"gf": "gotoSource:file",
"gb": "gotoSource:buffer",
"[[": "sourcePrev",
"]]": "sourceNext",
"[d": "diagnosticPrev",
"]d": "diagnosticNext",
"[c": "gitPrev",
"]c": "gitNext",
"<<": "gitStage",
">>": "gitUnstage"
}
}

View File

@@ -0,0 +1,3 @@
(require :plugins)
(require :settings.general)

View File

@@ -0,0 +1,15 @@
(fn setup [module args]
`((. (require ,module) :setup) ,args))
(fn packer [config ...]
"syntactic sugar over packer's startup function."
(local packer `(require :packer))
`((. ,packer :startup)
{1 (lambda [(unquote (sym :use))]
(use :wbthomason/packer.nvim)
(do ,...)
(if (= true _G.packer_bootstrap)
((. ,packer :sync))))
:config ,config}))
{: setup : packer}

View File

@@ -0,0 +1,112 @@
(import-macros {: packer-setup! : use!} :hibiscus.packer)
(import-macros {: packer : setup} :macros)
(packer-setup!)
(packer
{:display {:open_fn (. (require :packer.util) :float)}}
(use! :lewis6991/impatient.nvim)
(use! :udayvir-singh/tangerine.nvim)
(use! :udayvir-singh/hibiscus.nvim)
(use! "~/.config/nvim/themes/solarized.nvim"
:require :settings.solarized)
(use! :nvim-treesitter/nvim-treesitter
:run (fn [] ((. (require :nvim-treesitter.install) :update) {:with_sync true}))
:require :settings.treesitter)
(use! :feline-nvim/feline.nvim
:requires [:kyazdani42/nvim-web-devicons
"~/.config/nvim/themes/solarized.nvim"]
:after [:solarized.nvim]
:require :settings.feline)
(use! :s1n7ax/nvim-window-picker
:require :settings.window-picker)
(use! :nvim-neo-tree/neo-tree.nvim
:branch "v2.x"
:requires [:nvim-lua/plenary.nvim
:nvim-telescope/telescope.nvim
:kyazdani42/nvim-web-devicons
:MunifTanjim/nui.nvim
:s1n7ax/nvim-window-picker
:edluffy/hologram.nvim]
:after [:nvim-window-picker
:hologram.nvim]
:require :settings.neo-tree)
(use! :mrjones2014/smart-splits.nvim
:require :settings.smart-splits)
(use! :famiu/bufdelete.nvim
:require :bufdelete)
(use! :akinsho/bufferline.nvim
:tag "v2.*"
:requires [:kyazdani42/nvim-web-devicons
:famiu/bufdelete.nvim
"~/.config/nvim/themes/solarized.nvim"]
:after [:bufdelete.nvim
:solarized.nvim]
:require :settings.bufferline)
(use! :windwp/nvim-autopairs
:require :settings.autopairs)
(use! :lewis6991/gitsigns.nvim
:require :settings.gitsigns)
(use! :declancm/cinnamon.nvim
:require :settings.cinnamon)
(use! :stevearc/aerial.nvim
:require :settings.aerial)
(use! :nmac427/guess-indent.nvim
:require :settings.guess-indent)
(use! :nvim-telescope/telescope.nvim
:requires [:nvim-lua/plenary.nvim
:s1n7ax/nvim-window-picker]
:after [:nvim-window-picker]
:require :settings.telescope)
(use! :sindrets/diffview.nvim
:requires [:nvim-lua/plenary.nvim]
:require :settings.diffview)
(use! :neovim/nvim-lspconfig
:requires [:williamboman/mason-lspconfig.nvim
:williamboman/mason.nvim
:hrsh7th/cmp-omni
:hrsh7th/cmp-nvim-lsp
:onsails/lspkind.nvim
:hrsh7th/nvim-cmp
:saadparwaiz1/cmp_luasnip
:rafamadriz/friendly-snippets
:L3MON4D3/LuaSnip]
:require :settings.lspconfig)
(use! :jose-elias-alvarez/null-ls.nvim
:require :settings.null-ls)
(use! :lervag/vimtex
:require :settings.vimtex)
(use! :edluffy/hologram.nvim
:require :settings.hologram)
(use! :lambdalisue/suda.vim)
(use! :folke/noice.nvim
:event :VimEnter
:requires [:MunifTanjim/nui.nvim]
:require :settings.noice)
(use! :glacambre/firenvim
:run (fn [] ((. vim.fn :firenvim#install) 0))
:require :settings.firenvim))

View File

@@ -0,0 +1,18 @@
(import-macros {: map!} :hibiscus.vim)
(import-macros {: setup} :macros)
(if (= vim.g.started_by_firenvim nil)
(setup :aerial
{:backends [:lsp :treesitter]
:layout {:width 30
:placement "edge"}
:attach_mode "global"
:close_automatic_events [:unsupported]
:open_automatic true
:ignore {:filetypes [""
"neo-tree"
"aerial"
"packer"
"qf"
"help"
"DiffviewFileHistory"]}}))

View File

@@ -0,0 +1,3 @@
(import-macros {: setup} :macros)
(setup :nvim-autopairs)

View File

@@ -0,0 +1,20 @@
(import-macros {: map!} :hibiscus.vim)
(import-macros {: setup} :macros)
(local colors (require :solarized.colors))
(if (= vim.g.started_by_firenvim nil)
(setup :bufferline
{:options {:close_command "Bdelete %d"
:right_mouse_command "Bdelete %d"
:offsets [{:filetype "neo-tree" :text "File Explorer" :padding 1}
{:filetype "aerial" :text "Outline" :padding 1}]
:enforce_regular_tabs true
:separator_style "slant"}
:highlights {:separator {:fg colors.bg_alt}
:separator_visible {:fg colors.bg_alt}
:separator_selected {:fg colors.bg_alt}}}))
(map! [n] :<S-Right> ":bnext<CR>")
(map! [n] :<S-Left> ":bprevious<CR>")
(map! [n] :q ":Bwipeout<CR>")

View File

@@ -0,0 +1,3 @@
(import-macros {: setup} :macros)
(setup :cinnamon)

View File

@@ -0,0 +1,10 @@
(import-macros {: map!} :hibiscus.vim)
(import-macros {: setup} :macros)
(setup :diffview
{:keymaps {:view {:q ":tabc<CR>"}
:file_panel {:q ":tabc<CR>"}
:file_history_panel {:q ":tabc<CR>"}}})
(map! [n] :r ":DiffviewOpen<CR>")
(map! [n] :R ":DiffviewFileHistory %<CR>")

View File

@@ -0,0 +1,33 @@
(import-macros {: setup} :macros)
(local colors (require :solarized.colors))
(local theme
{:fg colors.fg
:bg colors.bg_alt
:black colors.black
:skyblue colors.paleblue
:cyan colors.cyan
:green colors.green
:oceanblue colors.blue
:magenta colors.magenta
:orange colors.orange
:red colors.red
:violet colors.purple
:white colors.white
:yellow colors.yellow})
(if (= vim.g.started_by_firenvim nil)
(setup :feline
{:theme theme
:force_inactive {:filetypes ["^neo\\-tree$"
"^aerial$"
"^packer$"
"^startify$"
"^fugitive$"
"^fugitiveblame$"
"^qf$"
"^help$"
"^DiffviewFileHistory"]
:buftypes ["^terminal$"]
:bufnames ["neo\\-.*"]}}))

View File

@@ -0,0 +1,9 @@
(import-macros {: g!} :hibiscus.vim)
(g! :firenvim_config {:globalSettings {:alt "all"}
:localSettings {:.* {:cmdline "neovim"
:content "text"
:priority 0
:selector "textarea"
:takeover "always"}
:https://zimbra.inria.fr/ {:selector "body[id=tinymce]"}}})

View File

@@ -0,0 +1,16 @@
(import-macros {: g! : set!} :hibiscus.vim)
(g! :maplocalleader ",")
(set! :clipboard "unnamedplus")
(set! :expandtab true)
(set! :fileencoding "utf-8")
(set! :ignorecase true)
(set! :mouse "a")
(set! :showmode false)
(set! :number true)
(set! :shiftwidth 2)
(set! :signcolumn "yes")
(set! :smartcase true)
(set! :spelllang "en")
(set! :tabstop 2)

View File

@@ -0,0 +1,3 @@
(import-macros {: setup} :macros)
(setup :gitsigns)

View File

@@ -0,0 +1,3 @@
(import-macros {: setup} :macros)
(setup :guess-indent)

View File

@@ -0,0 +1,4 @@
(import-macros {: setup} :macros)
(setup :hologram
{:auto_display false})

View File

@@ -0,0 +1,87 @@
(import-macros {: exec! : map!} :hibiscus.vim)
(local M {})
(local files
{:dictionary (.. (vim.fn.stdpath "config") "/spell/en.utf-8.add")
:disabledRules (.. (vim.fn.stdpath "config") "/spell/disable.txt")
:hiddenFalsePositives (.. (vim.fn.stdpath "config") "/spell/false.txt")})
(fn file_exists [file]
(let [f (io.open file "rb")]
(if f
(do (f:close) true)
false)))
(fn lines_from [file]
(if (file_exists file)
(icollect [line (io.lines file)] line)
[]))
(fn get_client_by_name [name]
(let [buf_clients (vim.lsp.buf_get_clients)]
(var found_client nil)
(each [_ client (ipairs buf_clients) :until found_client]
(match client.name name (set found_client client)))
found_client))
(fn update_config [lang configtype]
(let [client (get_client_by_name "ltex")]
(if (and client (. client.config.settings.ltex configtype))
(do (tset client.config.settings.ltex configtype {lang (lines_from (. files configtype))})
(client.notify "workspace/didChangeConfiguration" client.config.settings))
(vim.notify "Error when reading dictionary config, check it"))))
(fn add_to_file [configtype lang file value]
(let [dict (lines_from file)]
(var found_existing false)
(each [_ v (ipairs dict) :until found_existing]
(if (= v value) (set found_existing true)))
(if (not found_existing)
(let [file (io.open file "a+")]
(if file
(do (file:write (.. value "\n"))
(file:close)
(update_config lang configtype))
(vim.notify (string.format "Failed insert %s" value)))))))
(fn do_command [arg configtype]
(each [lang words (pairs arg)]
(each [_ word (ipairs words)]
(add_to_file configtype lang (. files configtype) word))))
(tset vim.lsp.commands "_ltex.addToDictionary"
(fn [command _] (do_command (. command.arguments 1 :words) :dictionary)))
(tset vim.lsp.commands "_ltex.disableRules"
(fn [command _] (do_command (. command.arguments 1 :ruleIds) :disabledRules)))
(tset vim.lsp.commands "_ltex.hideFalsePositives"
(fn [command _] (do_command (. command.arguments 1 :falsePositives) :hiddenFalsePositives)))
(fn post_attach []
(exec! [setlocal spell] [setlocal nospell])
(update_config "en-US" "dictionary")
(update_config "en-US" "disabledRules")
(update_config "en-US" "hiddenFalsePositives")
(map! [n :buffer :verbose] :zug (fn [] (exec! [normal! zug])
(update_config "en-US" "dictionary")
nil)
"Remove word from spellfile and update ltex")
(map! [n :buffer :verbose] :zg (fn [] (exec! [normal! zg])
(update_config "en-US" "dictionary")
nil)
"Add word to spellfile and update ltex")
nil)
(fn M.setup [opts]
((. (require :lspconfig) :ltex :setup)
{:on_attach (fn [client] (opts.on_attach client)
(post_attach)
nil)
:capabilities opts.capabilities
:flags opts.flags
:settings {:ltex {:dictionary []
:disabledRules []
:hiddenFalsePositives []}
:additionalRules {:enablePickyRules true}}}))
M

View File

@@ -0,0 +1,82 @@
(import-macros {: map!} :hibiscus.vim)
(import-macros {: setup} :macros)
(local servers
[:bashls
:eslint
:gopls
:java_language_server
:ltex
:lua_ls
:pyright
:tsserver])
; Mappings.
(map! [n :noremap] "<space>e" vim.diagnostic.open_float)
(map! [n :noremap] "[d" vim.diagnostic.goto_prev)
(map! [n :noremap] "]d" vim.diagnostic.goto_next)
(map! [n :noremap] "<space>q" vim.diagnostic.setloclist)
(fn on_attach [_ bufnr]
(map! [n :noremap :buffer] :gD vim.lsp.buf.declaration)
(map! [n :noremap :buffer] :gd vim.lsp.buf.definition)
(map! [n :noremap :buffer] :K vim.lsp.buf.hover)
(map! [n :noremap :buffer] :gi vim.lsp.buf.implementation)
(map! [n :noremap :buffer] :<C-k> vim.lsp.buf.signature_help)
(map! [n :noremap :buffer] :<space>wa vim.lsp.buf.add_workspace_folder)
(map! [n :noremap :buffer] :<space>wr vim.lsp.buf.remove_workspace_folder)
(map! [n :noremap :buffer] :<space>wl (fn [] (print (vim.inspect (vim.lsp.buf.list_workspace_folders)))))
(map! [n :noremap :buffer] :<space>D vim.lsp.buf.type_definition)
(map! [n :noremap :buffer] :<space>rn vim.lsp.buf.rename)
(map! [n :noremap :buffer] :<space>ca vim.lsp.buf.code_action)
(map! [n :noremap :buffer] :gr vim.lsp.buf.references)
(map! [n :noremap :buffer] :<space>f vim.lsp.buf.formatting))
(local capabilities ((. (require :cmp_nvim_lsp) :default_capabilities) (vim.lsp.protocol.make_client_capabilities)))
(setup :mason)
(setup :mason-lspconfig
{:ensure_installed servers})
(each [_ lsp (pairs servers)]
(local lsp_opts
{:on_attach on_attach
:capabilities capabilities
:flags {:debounce_text_changes 150}})
(local (status config) (pcall require (.. "settings.lsp." lsp)))
(if status
(config.setup lsp_opts)
((. (require :lspconfig) lsp :setup) lsp_opts)))
; LuaSnip setup
(local luasnip (require :luasnip))
((. (require :luasnip.loaders.from_vscode) :lazy_load))
; nvim-cmp setup
(local lspkind (require :lspkind))
(local cmp (require :cmp))
(cmp.setup
{:snippet {:expand (fn [args] (luasnip.lsp_expand args.body))}
:mapping (cmp.mapping.preset.insert
{:<C-d> (cmp.mapping.scroll_docs -4)
:<C-f> (cmp.mapping.scroll_docs 4)
:<C-Space> (cmp.mapping.complete)
:<CR> (cmp.mapping.confirm {:behavior cmp.ConfirmBehavior.Replace
:select true})
:<Tab> (cmp.mapping
(fn [fallback] (if (cmp.visible)
(cmp.select_next_item)
(luasnip.expand_or_jumpable)
(luasnip.expand_or_jump)
(fallback)))
[:i :s])
:<S-Tab> (cmp.mapping
(fn [fallback] (if (cmp.visible)
(cmp.select_prev_item)
(luasnip.jumpable -1)
(luasnip.jump -1)
(fallback)))
[:i :s])})
:sources [{:name "luasnip"}
{:name "nvim_lsp"}]
:formatting {:format (lspkind.cmp_format {:mode "symbol_text"})}})

View File

@@ -0,0 +1,78 @@
(import-macros {: g! : exec! : map! : augroup!} :hibiscus.vim)
(import-macros {: setup} :macros)
(g! :neo_tree_remove_legacy_commands 1)
(setup :neo-tree
{:close_if_last_window true
:window {:width 30
:mappings {:<cr> "open_with_window_picker"
:S "split_with_window_picker"
:s "vsplit_with_window_picker"}}
:filesystem {:filtered_items {:visible true}
:follow_current_file true
:window {:mappings {:/ "noop"
:g/ "fuzzy_finder"
:f "noop"
:ff (fn [] (exec! [Telescope find_files]))
:fg (fn [] (exec! [Telescope live_grep]))
:<CR> "custom_open"
:e "open"
:<S-Right> (fn [])
:<S-Left> (fn [])}}
:commands {:custom_open (fn [state]
(let [node (state.tree:get_node)
path (node:get_id)
quoted_path (.. "'" (.. path "'"))]
(match (path:match "^.+%.(.+)$")
"png" (let [bufnr (vim.api.nvim_create_buf false true)
image (: (require :hologram.image) :new path {})
max_width (- vim.o.columns 4)
max_height (- vim.o.lines 2)
tmp_width (math.min image.cols max_width)
tmp_height (* image.rows (/ tmp_width image.cols))
height (math.min tmp_height max_height)
width (* image.cols (/ height image.rows))
winnr (vim.api.nvim_open_win bufnr true {:relative "editor"
:width (math.ceil width)
:height (+ (math.ceil height) 1)
:row 0
:col 2})]
(exec! [setlocal nonumber])
(vim.api.nvim_buf_attach bufnr false {:on_detach (fn [_ bufnr]
(image:delete bufnr {:free true}))})
(image:display 1 0 bufnr {}))
_ (do
(exec! [silent
!file -bL --mime `(.. "'" quoted_path "'")
| grep -qv "^text\\|^inode\\|^application/json"])
(if (= vim.v.shell_error 1)
((. (require :neo-tree.sources.filesystem.commands) :open_with_window_picker) state)
(exec! [silent
!xdg-open `(.. "'" quoted_path "'")
&]))))))}}
:renderers {:directory [[:indent]
[:icon]
[:current_filter]
[:name]
[:clipboard]
{1 :diagnostics :errors_only true}]
:file [[:indent]
[:icon]
{1 :name :use_git_status_colors true :zindex 10}
[:clipboard]
[:bufnr]
[:modified]
[:diagnostics]
[:git_status]]}})
(map! [n] :f ":Neotree focus<CR>")
(map! [n] :F (fn [] (exec! [Neotree toggle] [Neotree toggle action=show])))
(augroup! :neo-tree [[FileType] [qf] "set nobuflisted|call feedkeys(\"F\")"])
; Startup
(if (= vim.g.started_by_firenvim nil)
(if (or (= (vim.fn.expand "%") "") (not= (vim.fn.isdirectory (vim.fn.expand "%")) 0))
((. (require :neo-tree.command) :execute) {:action "focus" :dir (vim.fn.getcwd)})
((. (require :neo-tree.command) :execute) {:action "show" :dir (vim.fn.getcwd)})))

View File

@@ -0,0 +1,3 @@
(import-macros {: setup} :macros)
(setup :noice)

View File

@@ -0,0 +1,4 @@
(import-macros {: setup} :macros)
(setup :null-ls
{:sources [(. (require :null-ls) :builtins :diagnostics :flake8)]})

View File

@@ -0,0 +1,12 @@
(import-macros {: map!} :hibiscus.vim)
(local smart-splits (require :smart-splits))
(map! [n] :<C-Left> smart-splits.move_cursor_left)
(map! [n] :<C-Down> smart-splits.move_cursor_down)
(map! [n] :<C-Up> smart-splits.move_cursor_up)
(map! [n] :<C-Right> smart-splits.move_cursor_right)
(map! [n] :<C-S-Up> smart-splits.resize_up)
(map! [n] :<C-S-Down> smart-splits.resize_down)
(map! [n] :<C-S-Left> smart-splits.resize_left)
(map! [n] :<C-S-Right> smart-splits.resize_right)

View File

@@ -0,0 +1,11 @@
(import-macros {: g!} :hibiscus.vim)
(g! :solarized_italic_comments true)
(g! :solarized_italic_keywords true)
(g! :solarized_italic_functions true)
(g! :solarized_italic_variables false)
(g! :solarized_contrast true)
(g! :solarized_borders false)
(g! :solarized_disable_background false)
((. (require :solarized) :set))

View File

@@ -0,0 +1,19 @@
(import-macros {: setup} :macros)
(local actions (require :telescope.actions))
(setup :telescope
{:defaults {:mappings {:n {:S actions.file_split
:s actions.file_vsplit}}
:get_selection_window (. (require :window-picker) :pick_window)}
:pickers {:find_files {:find_command [:fd "--type" "f"
"--strip-cwd-prefix"
"--hidden"]}
:live_grep {:vimgrep_arguments ["rg"
"--color=never"
"--no-heading"
"--with-filename"
"--line-number"
"--column"
"--smart-case"
"--hidden"]}}})

View File

@@ -0,0 +1,20 @@
(import-macros {: setup} :macros)
(setup :nvim-treesitter.configs
{:ensure_installed
[:bash
:c
:fennel
:java
:javascript
:lua
:python
:rust
:typescript]
:sync_install false
:ignore_install []
:highlight {:enable true
:disable []
:additional_vim_regex_highlighting false}})
((. (require :nvim-treesitter.install) :setup_auto_install))

View File

@@ -0,0 +1,4 @@
(import-macros {: g!} :hibiscus.vim)
(g! :vimtex_view_method "zathura")
(g! :vimtex_syntax_enabled 0)

View File

@@ -0,0 +1,7 @@
(import-macros {: setup} :macros)
(setup :window-picker
{:autoselect_one true
:selection_chars "ABCDEFGHIJKLMNOP"
:filter_rules {:bo {:filetype [:NvimTree :neo-tree :notify :aerial]
:buftype [:terminal]}}})

View File

@@ -1,148 +0,0 @@
tnoremap <Esc> <C-\><C-n>
set termguicolors
"set colorcolumn=88
set background=dark
match Error /\%>88c/
highlight Pmenu ctermbg=gray guibg=gray
" if hidden is not set, TextEdit might fail.
set hidden
" Some servers have issues with backup files, see #649
set nobackup
set nowritebackup
" Better display for messages
set cmdheight=2
" You will have bad experience for diagnostic messages when it's default 4000.
set updatetime=300
" don't give |ins-completion-menu| messages.
set shortmess+=c
" always show signcolumns
set signcolumn=yes
" Use tab for trigger completion with characters ahead and navigate.
" Use command ':verbose imap <tab>' to make sure tab is not mapped by other plugin.
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
" Use <c-space> to trigger completion.
inoremap <silent><expr> <c-space> coc#refresh()
" Use <cr> to confirm completion, `<C-g>u` means break undo chain at current position.
" Coc only does snippet and additional edit on confirm.
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
" Or use `complete_info` if your vim support it, like:
" inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
" Use `[g` and `]g` to navigate diagnostics
nmap <silent> [g <Plug>(coc-diagnostic-prev)
nmap <silent> ]g <Plug>(coc-diagnostic-next)
" Remap keys for gotos
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>')
else
call CocAction('doHover')
endif
endfunction
" Highlight symbol under cursor on CursorHold
autocmd CursorHold * silent call CocActionAsync('highlight')
" Remap for rename current word
nmap <leader>rn <Plug>(coc-rename)
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
" Remap for do codeAction of selected region, ex: `<leader>aap` for current paragraph
xmap <leader>a <Plug>(coc-codeaction-selected)
nmap <leader>a <Plug>(coc-codeaction-selected)
" Remap for do codeAction of current line
nmap <leader>ac <Plug>(coc-codeaction)
" Fix autofix problem of current line
nmap <leader>qf <Plug>(coc-fix-current)
" Create mappings for function text object, requires document symbols feature of
" languageserver.
xmap if <Plug>(coc-funcobj-i)
xmap af <Plug>(coc-funcobj-a)
omap if <Plug>(coc-funcobj-i)
omap af <Plug>(coc-funcobj-a)
" Use <TAB> for select selections ranges, needs server support, like: coc-tsserver,
" coc-python
nmap <silent> <TAB> <Plug>(coc-range-select)
xmap <silent> <TAB> <Plug>(coc-range-select)
" Use `:Format` to format current buffer
command! -nargs=0 Format :call CocAction('format')
" Use `:Fold` to fold current buffer
command! -nargs=? Fold :call CocAction('fold', <f-args>)
" use `:OR` for organize import of current buffer
command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport')
" Add status line support, for integration with other plugin, checkout `:h coc-status`
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
" Using CocList
" Show all diagnostics
nnoremap <silent> <space>a :<C-u>CocList diagnostics<cr>
" Manage extensions
nnoremap <silent> <space>e :<C-u>CocList extensions<cr>
" Show commands
nnoremap <silent> <space>c :<C-u>CocList commands<cr>
" Find symbol of current document
nnoremap <silent> <space>o :<C-u>CocList outline<cr>
" Search workspace symbols
nnoremap <silent> <space>s :<C-u>CocList -I symbols<cr>
" Do default action for next item.
nnoremap <silent> <space>j :<C-u>CocNext<CR>
" Do default action for previous item.
nnoremap <silent> <space>k :<C-u>CocPrev<CR>
" Resume latest coc list
nnoremap <silent> <space>p :<C-u>CocListResume<CR>
" coc-explorer
nmap <leader>e :CocCommand explorer<CR>
call plug#begin()
Plug 'rbgrouleff/bclose.vim'
Plug 'francoiscabrol/ranger.vim'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'lervag/vimtex'
Plug 'iCyMind/NeoSolarized'
call plug#end()
colorscheme NeoSolarized

View File

@@ -0,0 +1,36 @@
local install_path = vim.fn.stdpath('data')..'/site/pack/packer/start/'
local function bootstrap(repo)
local url = 'https://github.com/' .. repo
local name = repo:gsub('.*/', '')
local path = install_path .. name
local bootstrapped = false
if vim.fn.empty(vim.fn.glob(path)) > 0 then
vim.fn.system({'git', 'clone', '--depth', '1', url, path})
vim.cmd('packadd ' .. name)
bootstrapped = true
end
return bootstrapped
end
bootstrap('lewis6991/impatient.nvim')
require('impatient')
local tangerine_bootstrapped = bootstrap('udayvir-singh/tangerine.nvim')
bootstrap('udayvir-singh/hibiscus.nvim')
if tangerine_bootstrapped then
require('tangerine').setup({
compiler = {
hooks = {'oninit'}
}
})
require('init')
else
require('tangerine').setup({})
local diagnostics = require('tangerine.vim.hooks').run()
require('init')
if #diagnostics > 0 then
require('packer').sync()
end
end

1
.config/nvim/spell/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
false.txt

View File

@@ -0,0 +1 @@
PASSIVE_VOICE

View File

@@ -0,0 +1,23 @@
Read-Eval-Print-Loop
Flexowriter
Teitelman
Interlisp
JOHNNIAC
REPLs
Mathematica
GPLs
Plasil
Monto
Keidel
Meinte
Asf
Sdf
ToolBus
projectional
QL
DSLs
Coulon
JADEL
microservicization
ISEC
Jeanjean

View File

@@ -446,6 +446,7 @@ map yp yank path
map yd yank dir
map yn yank name
map y. yank name_without_extension
map <C-d> shell dragon-drop -a -x %p
# Filesystem Operations
map = chmod

View File

@@ -1,3 +1,7 @@
configuration {
modi: "run,mugen:~/.config/rofi/modi/mugen";
}
* {
active-background: #20ABE0;
active-foreground: @foreground;
@@ -22,7 +26,7 @@
background: #00000000;
background-color: @background;
background-opaque: #002b36cc;
background-opaque: #002b36ff;
foreground: #93a1a1;
border-color: @foreground;
spacing: 2;

27
.config/rofi/modi/mugen Executable file
View File

@@ -0,0 +1,27 @@
#!/bin/sh
mugen_host=${MUGEN_HOST:-https://kara.moe}
kara_api="${MUGEN_KARA_API:-$mugen_host/api/karas}"
karamedia="${MUGEN_KARAOKEMEDIA:-$mugen_host/downloads}"
# karaoke medias and lyrics directories
medias="$karamedia/medias"
lyrics="$karamedia/lyrics"
kid=$ROFI_INFO
if [ -z "$@" ]; then
/usr/bin/printf "\0prompt\x1fkaraoke search\n"
exit 0
else
if [ -z "$kid" ]; then
/usr/bin/printf "\0prompt\x1fmugen\n"
query="$(echo "$@" | tr " " "+")"
curl "https://kara.moe/api/karas/search?collections=dbcf2c22-524d-4708-99bb-601703633927,c7db86a0-ff64-4044-9be4-66dd1ef1d1c1,2fa2fe3f-bb56-45ee-aa38-eae60e76f224,efe171c0-e8a1-4d03-98c0-60ecf741ad52&filter=$query&size=100" | jq -r '.content | .[] | "\(.mediafile)\u0000info\u001f\(.kid)"'
fi
fi
# choose karaoke
[ -z "$kid" ] && exit
umpv "https://kara.moe/kara/$kid" > /dev/null 2>&1 &
exec 1>&-

164
.config/rofi/topleft.rasi Normal file
View File

@@ -0,0 +1,164 @@
* {
active-background: #20ABE0;
active-foreground: @foreground;
normal-background: @background;
normal-foreground: @foreground;
urgent-background: #288AB2;
urgent-foreground: @foreground;
alternate-active-background: @background;
alternate-active-foreground: @foreground;
alternate-normal-background: @background;
alternate-normal-foreground: @foreground;
alternate-urgent-background: @background;
alternate-urgent-foreground: @foreground;
selected-active-background: #288AB2;
selected-active-foreground: @foreground;
selected-normal-background: #859900cc;
selected-normal-foreground: #002b36;
selected-urgent-background: #4BB0CF;
selected-urgent-foreground: @foreground;
background: #00000000;
background-color: @background;
background-opaque: #002b36ff;
foreground: #93a1a1;
border-color: @foreground;
spacing: 2;
}
#window {
background-color: @background-opaque;
border: 0px;
padding: 0ch 0.5ch 0ch 0.5ch;
}
#mainbox {
border: 0;
padding: 0;
}
#message {
border: 2px 0px 0px;
border-color: @border-color;
padding: 1px;
}
#textbox {
text-color: @foreground;
}
inputbar {
children: [ prompt,textbox-prompt-colon,entry,case-indicator ];
}
textbox-prompt-colon {
expand: false;
str: ":";
margin: 0px 0.3em 0em 0em;
text-color: @normal-foreground;
}
#listview {
fixed-height: 0;
border: 1px 0px 0px;
border-color: @border-color;
spacing: 3px;
scrollbar: true;
padding: 9px 0px 0px;
}
#element {
border: 0;
padding: 3px 3px 3px;
}
#element.normal.normal {
background-color: @normal-background;
text-color: @normal-foreground;
}
#element.normal.urgent {
background-color: @urgent-background;
text-color: @urgent-foreground;
}
#element.normal.active {
background-color: @active-background;
text-color: @active-foreground;
}
#element.selected.normal {
background-color: @selected-normal-background;
text-color: @selected-normal-foreground;
border: 0px;
border-color: @foreground;
}
#element.selected.urgent {
background-color: @selected-urgent-background;
text-color: @selected-urgent-foreground;
}
#element.selected.active {
background-color: @selected-active-background;
text-color: @selected-active-foreground;
}
#element.alternate.normal {
background-color: @alternate-normal-background;
text-color: @alternate-normal-foreground;
}
#element.alternate.urgent {
background-color: @alternate-urgent-background;
text-color: @alternate-urgent-foreground;
}
#element.alternate.active {
background-color: @alternate-active-background;
text-color: @alternate-active-foreground;
}
#scrollbar {
width: 4px;
border: 0;
handle-width: 8px;
padding: 0;
}
#sidebar {
border: 2px 0px 0px;
border-color: @border-color;
}
#button.selected {
background-color: @selected-normal-background;
text-color: @selected-normal-foreground;
}
#inputbar {
spacing: 0;
text-color: @normal-foreground;
padding: 1px;
}
#case-indicator {
spacing: 0;
text-color: @normal-foreground;
}
#entry {
spacing: 0;
text-color: @normal-foreground;
}
#prompt {
spacing: 0;
text-color: @normal-foreground;
}
element-text {
text-color: inherit;
}

View File

@@ -0,0 +1,31 @@
[AdditionalOptions]
extensions =
custom_apps =
sidebar_config = 1
home_config = 1
[Patch]
[Setting]
prefs_path = /home/rhiobet/.config/spotify/prefs
overwrite_assets = 0
check_spicetify_upgrade = 0
spotify_path = /opt/spotify
current_theme = SpicetifyDefault
color_scheme =
inject_css = 1
replace_colors = 1
spotify_launch_flags =
[Preprocesses]
disable_sentry = 1
disable_ui_logging = 1
remove_rtl_rule = 1
expose_apis = 1
disable_upgrade_check = 1
; DO NOT CHANGE!
[Backup]
version =
with =

View File

@@ -6,12 +6,15 @@ color_scheme =
inject_css = 1
replace_colors = 1
overwrite_assets = 0
spotify_launch_flags =
check_spicetify_upgrade = 0
[Preprocesses]
remove_rtl_rule = 1
expose_apis = 1
disable_sentry = 1
disable_ui_logging = 1
disable_upgrade_check = 1
[AdditionalOptions]
home = 0
@@ -32,5 +35,5 @@ custom_apps =
; DO NOT CHANGE!
[Backup]
version = 1.1.10.546.ge08ef575
version = 1.1.56.595.g2d2da0de

View File

@@ -21,20 +21,31 @@ set $term kitty
# set $menu dmenu_path | dmenu | xargs swaymsg exec --
set $menu rofi -no-levenshtein-sort -color-enabled -show run\
-run-command "zsh -i -c '{cmd}'" | xargs swaymsg exec --
set $srclocker swaylock -c 222222 -u -i eDP-1:~/wallpapers/radiance.png\
-i DP-5:~/wallpapers/hornet.jpg -i DP-4:~/wallpapers/knight.jpg
#set $srclocker swaylock -c 222222 -u -i eDP-1:~/wallpapers/radiance.png\
# -i DP-5:~/wallpapers/hornet.jpg -i DP-4:~/wallpapers/knight.jpg
### Output configuration
#
# Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/)
# output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill
output eDP-1 pos 0 1480 res 1920 1080
output HDMI-A-1 pos 1920 1480 res 1920 1080
output "Samsung Electric Company SyncMaster H1AK500000" res 3840 2160
output "Dell Inc. DELL U2410 F525M0A1082L" pos 1920 680 res 1920 1200
output "Dell Inc. DELL U2717D JXRPT83GAHKS" pos 3840 0 mode --custom 2560x1440@39Hz transform 90
output * bg ~/wallpapers/filianore-u.jpg fill
output * pos 1920 0 res 1920 1080
output eDP-1 {
pos 0 0
res 2256 1504
scale 1.5
bg "~/wallpapers/priscilla.png" fill
}
output "Beihai Century Joint Innovation Technology Co.,Ltd MD49DQHD-2 0000000000000" {
pos 1504 0
res 5120 1440
bg "~/wallpapers/ranni.png" fill
}
focus output eDP-1
bindswitch --reload --locked lid:on output eDP-1 disable
bindswitch --reload --locked lid:off output eDP-1 enable
#
# Example configuration:
#
@@ -78,14 +89,11 @@ input "*" {
xkb_variant latin9
}
input "1102:4619:DLL07A0:01_044E:120B" {
input "2362:628:PIXA3854:00_093A:0274_Touchpad" {
tap enabled
natural_scroll enabled
}
input "9653:84:Samsung_electronics_inc._Samsung_HID_Multi-Touch"\
map_to_output "Samsung Electric Company SyncMaster H1AK500000"
### Key bindings
#
# Basics:
@@ -103,8 +111,8 @@ input "9653:84:Samsung_electronics_inc._Samsung_HID_Multi-Touch"\
bindsym XF86AudioMicMute exec amixer -c 0 sset Capture toggle
# Brightness
bindsym XF86MonBrightnessUp exec xbacklight -inc 5
bindsym XF86MonBrightnessDown exec xbacklight -dec 5
bindsym XF86MonBrightnessUp exec brightnessctl s +5%
bindsym XF86MonBrightnessDown exec brightnessctl s 5%-
# Start your launcher
bindsym $mod+r exec $menu
@@ -125,9 +133,11 @@ input "9653:84:Samsung_electronics_inc._Samsung_HID_Multi-Touch"\
'swaymsg exit'
# Screenshot
bindsym Print exec grim\
-o $(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name') -\
| wl-copy -t image/png
bindsym Print exec slurp -d | grim -g - - | wl-copy -t image/png
bindsym Ctrl+Print exec swaymsg -t get_tree | jq -r 'recurse(.nodes[], .floating_nodes[]) | select(.focused and .pid).rect | "\(.x),\(.y) \(.width)x\(.height)"' | grim -g - - | wl-copy -t image/png
bindsym Shift+Print exec grim -o $(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name') - | wl-copy -t image/png
#bindsym Shift+Print exec grim -o $(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name') - > /home/rhiobet/screenshots/$(date +%s).png
#
# Moving around:
#
@@ -251,49 +261,70 @@ bindsym Ctrl+Alt+l exec $srclocker
bar {
position top
pango_markup enabled
font pango:DejaVu Sans Mono, FontAwesome 10
font pango:DejaVuSansM Nerd Font Mono, FontAwesome 10
# When the status_command prints a new line to stdout, swaybar updates.
# The default just shows the current date and time.
#status_command while ~/.config/sway/status.sh; do sleep 1; done
status_command i3status-rs ~/.config/sway/status.toml
# status_command i3status-rs ~/.config/sway/status.toml
swaybar_command waybar
status_padding 0
colors {
statusline #ffffff
background #002b36cc
inactive_workspace #002b36cc #002b36cc #93a1a1
active_workspace #859900cc #859900cc #002b36
focused_workspace #859900cc #859900cc #002b36
background #002b36ff
inactive_workspace #002b36ff #002b36ff #93a1a1
active_workspace #859900ff #859900ff #002b36
focused_workspace #859900ff #859900ff #002b36
}
}
hide_edge_borders both
default_border none
gaps inner 6
#smart_gaps on
client.focused #859900ff #859900ff #002b36
client.focused_inactive #859900ff #859900ff #002b36
client.unfocused #002b36ff #002b36ff #93a1a1
titlebar_padding 5 1
include /etc/sway/config.d/*
# Assignments
assign [class="discord"] workspace 3
assign [class="Spotify"] workspace 3
for_window [class="Spotify"] opacity 0.8
#for_window [class="Chromium"] opacity 0.9
exec redshift -O 4500 -m wayland
exec megasync
exec nm-applet --indicator
for_window [class="Spotify"] {
floating enable
sticky enable
}
for_window [app_id="boop-gtk"] floating enable
exec qjackctl
for_window [class="QjackCtl"] floating enable
for_window [title="Graphe — QjackCtl"] floating disable
exec ~/.local/start_jack.sh
#exec redshift -O 4500 -m wayland
exec wlanthy -i pass
exec ~/.config/sway/workspace-rename.sh
# exec ~/.local/start-jack.sh
exec ~/.config/sway/workspace_rename.py > ~/.cache/workspace_rename.log 2> ~/.cache/workspace_rename_error.log
for_window [class="Tor Browser"] floating enable
for_window [class="steam_proton"] floating enable
for_window [app_id="mpv"] {
floating enable
sticky enable
}
for_window [app_id="kitty-scratch"] {
border pixel 1
}
for_window [app_id="kitty-scratch|pavucontrol|org.keepassxc.KeePassXC"] {
move to scratchpad
scratchpad show
}
workspace 1 output eDP-1
exec $term
@@ -301,18 +332,9 @@ workspace 2 output eDP-1
workspace 3 output eDP-1
exec discord
exec spotify
workspace 4 output "Dell Inc. DELL U2410 F525M0A1082L"
workspace 5 output "Dell Inc. DELL U2410 F525M0A1082L"
workspace 6 output "Dell Inc. DELL U2410 F525M0A1082L"
workspace 7 output "Dell Inc. DELL U2717D JXRPT83GAHKS"
workspace 8 output "Dell Inc. DELL U2717D JXRPT83GAHKS"
workspace 9 output "Dell Inc. DELL U2717D JXRPT83GAHKS"
exec spotify-launcher
exec xrdb -load ~/.Xresources
# Application keybinds
bindsym Ctrl+m exec mpv $(wl-paste -t text)

View File

@@ -1,43 +1,52 @@
[icons]
icons = "awesome"
[theme]
name = "solarized-dark"
theme = "solarized-dark"
[theme.overrides]
idle_bg = "#002b36cc"
info_bg = "#268bd2cc"
good_bg = "#859900cc"
warning_bg = "#b58900cc"
critical_bg = "#dc322fcc"
idle_bg = "#002b36ff"
info_bg = "#268bd2ff"
good_bg = "#859900ff"
warning_bg = "#b58900ff"
critical_bg = "#dc322fff"
alternating_tint_bg = "#00000000"
separator = ""
separator = "<span font='15'>\ue0b2</span>"
#separator = ""
[[block]]
block = "focused_window"
max_width = 100
#[[block]]
#block = "focused_window"
#max_width = 100
[[block]]
block = "music"
player = "spotify"
buttons = ["play", "next"]
on_collapsed_click = "spotify"
max_width = 21
marquee = true
format = "$prev $play $next|"
[[block]]
block = "sound"
driver = "alsa"
#device = "hw:0"
driver = "auto"
show_volume_when_muted = true
headphones_indicator = true
step_width = 3
[[block.click]]
button = "left"
cmd = "pavucontrol"
[[block]]
block = "memory"
display_type = "memory"
format_mem = "{Mum}MB"
format_mem = "$mem_used.eng(3,B,M)"
clickable = false
[[block.click]]
button = "left"
cmd = "kitty --class kitty-scratch -c ~/.config/kitty/kitty-scratch.conf btop"
[[block]]
block = "cpu"
interval = 1
[[block.click]]
button = "left"
cmd = "kitty --class kitty-scratch -c ~/.config/kitty/kitty-scratch.conf btop"
#[[block]]
#block = "sound"
@@ -46,6 +55,26 @@ interval = 1
block = "battery"
interval = 10
[[block]]
block = "pacman"
interval = 600
format = "$both updates available"
format_singular = "$both update available"
format_up_to_date = "up to date"
hide_when_uptodate = true
critical_updates_regex = "(^(linux-|sway|wl)|pipewire)"
aur_command = "yay -Qua"
[[block.click]]
button = "left"
cmd = "kitty --class kitty-scratch -c ~/.config/kitty/kitty-scratch.conf zsh -i -c update"
[[block]]
block = "net"
format = "$device{| $ssid}"
[[block.click]]
button = "left"
cmd = "kitty --class kitty-scratch -c ~/.config/kitty/kitty-scratch.conf nmtui"
[[block]]
block = "time"
interval = 60

View File

@@ -13,7 +13,7 @@ swaymsg -t subscribe -m '[ "window" ]' | while read -r event ; do
if [ "$app_name" = "kitty" ] ; then
app_name=""
elif [ "$app_name" = "chromium" ] ; then
elif [[ "$app_name" == *"chrom"* ]] || [[ "$app_name" == *"Chrom"* ]]; then
case "$(jq -r '.container.name' <<< $event)" in
*YouTube*)
app_name=""

View File

@@ -0,0 +1,61 @@
#!/bin/python3
import asyncio
from i3ipc import Event
from i3ipc.aio import Connection
async def main():
sway = await Connection().connect()
@sway.on(Event.WINDOW_NEW)
@sway.on(Event.WINDOW_CLOSE)
@sway.on(Event.WINDOW_MOVE)
@sway.on(Event.WINDOW_TITLE)
async def on_window_change(sway, _):
for w in (await sway.get_tree()).workspaces():
new_name = f'{w.num}:'
first_descendant = True
for d in w.descendants():
app_name = d.app_id
if not app_name:
app_name = d.window_instance
if app_name:
if not first_descendant:
new_name += ' '
first_descendant = False
if 'kitty' in app_name:
if 'vim' in d.name:
new_name += '<span font=\'12\' rise=\'-2500\'>\ue6c5</span>'
else:
new_name += ''
elif app_name in ['Chromium', 'google-chrome', 'google-chrome-unstable']:
if 'YouTube' in d.name:
new_name += ''
else:
new_name += ''
elif app_name == 'Navigator':
new_name += ''
elif app_name == 'discord':
new_name += ''
elif app_name == 'spotify':
new_name += '<span font=\'11\' rise=\'-400\'></span>'
elif app_name in ['GEMOC Studio', 'code-oss']:
new_name += ''
elif 'okular' in app_name or 'zathura' in app_name:
new_name += '<span font=\'FontAwesome 5 Free Solid\'></span>'
elif app_name == 'pavucontrol':
new_name += ''
else:
new_name += app_name
await sway.command(f'rename workspace "{w.name}" to "{new_name}"')
await sway.main()
asyncio.run(main())

88
.config/waybar/config Normal file
View File

@@ -0,0 +1,88 @@
[{
"spacing": 4, // Gaps between modules (4px)
"modules-left": ["sway/workspaces", "wlr/taskbar"],
"modules-center": [],
"modules-right": ["pulseaudio", "memory", "cpu", "battery", "network", "custom/pacman", "clock", "tray"],
"memory": {
"format": "\uf538 {used:0.1f}GiB",
"on-click": "kitty --class kitty-scratch -c ~/.config/kitty/kitty-scratch.conf btop"
},
"sway/workspaces": {
"format": "{value}"
},
"wlr/taskbar": {
"on-click": "activate"
},
"tray": {
"spacing": 10
},
"clock": {
"tooltip-format": "<tt><small>{calendar}</small></tt>",
"calendar": {
"mode": "year",
"mode-mon-col": 3,
"format": {
"today": "<b><u>{}</u></b>"
}
},
"format": "\uf017 {:%A %d/%m/%Y %H:%M}"
},
"cpu": {
"format": "\uf2db {usage}%",
"tooltip": false,
"on-click": "kitty --class kitty-scratch -c ~/.config/kitty/kitty-scratch.conf btop"
},
"battery": {
"states": {
// "good": 95,
"warning": 30,
"critical": 15
},
"format": "{icon} {capacity}%",
"format-charging": " {capacity}%",
"format-plugged": " {capacity}%",
"format-alt": "{icon} {time}",
"format-icons": ["", "", "", "", ""]
},
"network": {
// "interface": "wlp2*", // (Optional) To force the use of this interface
"format-wifi": "\uf1eb {essid}",
"format-ethernet": "\uf6ff {ifname}",
"tooltip-format": "\f6ff {ifname} via {gwaddr}",
"format-linked": "\uf6ff {ifname} (No IP)",
"format-disconnected": "\uf071 Disconnected",
"on-click": "kitty --class kitty-scratch -c ~/.config/kitty/kitty-scratch.conf nmtui"
},
"pulseaudio": {
// "scroll-step": 1, // %, can be a float
"format": "{icon} {volume}% {format_source}",
"format-bluetooth": "{icon} {volume}% {format_source}",
"format-bluetooth-muted": "{icon}  {format_source}",
"format-muted": " {format_source}",
"format-source": " {volume}%",
"format-source-muted": "",
"format-icons": {
"headphone": "",
"hands-free": "",
"headset": "",
"phone": "",
"portable": "",
"car": "",
"default": ["", "", ""]
},
"on-click": "pavucontrol"
},
"custom/pacman": {
"format": "{icon} {}",
"return-type": "json",
"escape": true,
"format-icons": {
"uptodate": "\uf00c",
"available": "\uf019"
},
"interval": 600,
"exec": "$HOME/.config/waybar/pacman.py '(?:^(?:linux-|sway|wl)|pipewire)' 2> /dev/null",
"on-click": "kitty --class kitty-scratch -c ~/.config/kitty/kitty-scratch.conf zsh -i -c update"
}
}]

128
.config/waybar/mediaplayer.py Executable file
View File

@@ -0,0 +1,128 @@
#!/usr/bin/env python3
import argparse
import logging
import sys
import signal
import gi
import json
gi.require_version('Playerctl', '2.0')
from gi.repository import Playerctl, GLib
logger = logging.getLogger(__name__)
def write_output(text, player):
logger.info('Writing output')
output = {'text': text,
'class': 'custom-' + player.props.player_name,
'alt': player.props.player_name}
sys.stdout.write(json.dumps(output) + '\n')
sys.stdout.flush()
def on_play(player, status, manager):
logger.info('Received new playback status')
on_metadata(player, player.props.metadata, manager)
def on_metadata(player, metadata, manager):
logger.info('Received new metadata')
track_info = ''
if player.props.player_name == 'spotify' and \
'mpris:trackid' in metadata.keys() and \
':ad:' in player.props.metadata['mpris:trackid']:
track_info = 'AD PLAYING'
elif player.get_artist() != '' and player.get_title() != '':
track_info = '{artist} - {title}'.format(artist=player.get_artist(),
title=player.get_title())
else:
track_info = player.get_title()
if player.props.status != 'Playing' and track_info:
track_info = '' + track_info
write_output(track_info, player)
def on_player_appeared(manager, player, selected_player=None):
if player is not None and (selected_player is None or player.name == selected_player):
init_player(manager, player)
else:
logger.debug("New player appeared, but it's not the selected player, skipping")
def on_player_vanished(manager, player):
logger.info('Player has vanished')
sys.stdout.write('\n')
sys.stdout.flush()
def init_player(manager, name):
logger.debug('Initialize player: {player}'.format(player=name.name))
player = Playerctl.Player.new_from_name(name)
player.connect('playback-status', on_play, manager)
player.connect('metadata', on_metadata, manager)
manager.manage_player(player)
on_metadata(player, player.props.metadata, manager)
def signal_handler(sig, frame):
logger.debug('Received signal to stop, exiting')
sys.stdout.write('\n')
sys.stdout.flush()
# loop.quit()
sys.exit(0)
def parse_arguments():
parser = argparse.ArgumentParser()
# Increase verbosity with every occurrence of -v
parser.add_argument('-v', '--verbose', action='count', default=0)
# Define for which player we're listening
parser.add_argument('--player')
return parser.parse_args()
def main():
arguments = parse_arguments()
# Initialize logging
logging.basicConfig(stream=sys.stderr, level=logging.DEBUG,
format='%(name)s %(levelname)s %(message)s')
# Logging is set by default to WARN and higher.
# With every occurrence of -v it's lowered by one
logger.setLevel(max((3 - arguments.verbose) * 10, 0))
# Log the sent command line arguments
logger.debug('Arguments received {}'.format(vars(arguments)))
manager = Playerctl.PlayerManager()
loop = GLib.MainLoop()
manager.connect('name-appeared', lambda *args: on_player_appeared(*args, arguments.player))
manager.connect('player-vanished', on_player_vanished)
signal.signal(signal.SIGINT, signal_handler)
signal.signal(signal.SIGTERM, signal_handler)
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
for player in manager.props.player_names:
if arguments.player is not None and arguments.player != player.name:
logger.debug('{player} is not the filtered player, skipping it'
.format(player=player.name)
)
continue
init_player(manager, player)
loop.run()
if __name__ == '__main__':
main()

80
.config/waybar/pacman.py Executable file
View File

@@ -0,0 +1,80 @@
#!/usr/bin/env python3
import json
import os
import re
import subprocess
import sys
PACMAN_DB = '/var/lib/pacman/'
PACMAN_UPDATES_DB = f'/tmp/checkup-db-{os.getlogin()}/'
def write_output(packages, important_regex):
n_packages = packages.count('\n')
if n_packages == 0:
output_text = 'Up to date'
output_class = 'good'
output_alt = 'uptodate'
else:
if n_packages == 1:
output_text = '1 update available'
else:
output_text = f'{n_packages} updates available'
output_class = 'info'
output_alt = 'available'
if important_regex and re.search(important_regex, packages,
flags=re.MULTILINE):
output_class = 'important'
output = {'text': output_text,
'class': output_class,
'alt': output_alt}
sys.stdout.write(json.dumps(output) + '\n')
sys.stdout.flush()
def generate_and_update_database():
if not os.path.isdir(PACMAN_UPDATES_DB):
os.mkdir(PACMAN_UPDATES_DB)
os.symlink(os.path.join(PACMAN_DB, 'local'),
os.path.join(PACMAN_UPDATES_DB, 'local'))
subprocess.run(['fakeroot',
'--',
'pacman',
'-Sy',
'--dbpath',
PACMAN_UPDATES_DB,
'--logfile',
'/dev/null'],
env={'LC_ALL': 'C'},
stdout=subprocess.DEVNULL,
stderr=subprocess.STDOUT)
def check_updates(important_regex):
p = subprocess.run(['yay',
'-Qu',
'--devel',
'--dbpath',
PACMAN_UPDATES_DB],
capture_output=True)
packages = p.stdout.decode('utf-8')
write_output(packages, important_regex)
def main(important_regex=None):
generate_and_update_database()
check_updates(important_regex)
if __name__ == '__main__':
if len(sys.argv) > 1:
main(sys.argv[1])
else:
main()

195
.config/waybar/style.css Normal file
View File

@@ -0,0 +1,195 @@
* {
font-family: "DejaVu Sans Mono", "Font Awesome 6 Free";
font-size: 13px;
}
window#waybar {
background-color: #002b36;
color: #93a1a1;
transition-property: background-color;
transition-duration: .5s;
}
window#waybar.hidden {
opacity: 0.2;
}
tooltip {
background-color: #002b36;
border: 1px solid #859900;
border-radius: 0px;
}
tooltip label {
color: #93a1a1;
}
#taskbar {
margin-left: 10px;
padding: 0px;
}
#taskbar button {
padding: 0px;
box-shadow: inset 0 -3px transparent;
border: none;
}
#taskbar button:hover {
background: inherit;
background-color: #268bd2;
-gtk-icon-shadow: none;
}
#taskbar button.active {
background-color: #859900;
}
#workspaces button {
color: #93a1a1;
padding: 0px;
/* Use box-shadow instead of border so the text isn't offset */
box-shadow: inset 0 -3px transparent;
/* Avoid rounded borders under each workspace name */
border: none;
}
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
#workspaces button:hover {
background: inherit;
text-shadow: none;
background-color: #268bd2;
color: #002b36;
}
#workspaces button.visible {
background-color: #859900;
color: #002b36;
}
#workspaces button.focused {
background-color: #859900;
color: #002b36;
}
#workspaces button.urgent {
background-color: #d30102;
color: #002b36;
}
#workspaces button,
#taskbar button,
#clock,
#battery,
#cpu,
#memory,
#network,
#pulseaudio,
#tray,
#custom-pacman {
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-radius: 25px / 25px;
background-clip: border-box;
}
#workspaces button:first-child {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
#window,
#workspaces {
margin: 0 20px;
}
/* If workspaces is the leftmost module, omit left margin */
.modules-left > widget:first-child > #workspaces {
margin-left: 0;
}
/* If workspaces is the rightmost module, omit right margin */
.modules-right > widget:last-child > #workspaces {
margin-right: 0;
}
#clock {
}
#battery {
}
#battery.charging, #battery.plugged {
background-color: #268bd2;
color: #002b36;
}
@keyframes blink {
to {
background-color: #ffffff;
color: #000000;
}
}
#battery.critical:not(.charging) {
background-color: #d30102;
color: #002b36;
animation-name: blink;
animation-duration: 0.5s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
label:focus {
background-color: #000000;
}
#cpu {
}
#memory {
}
#network {
}
#network.disconnected {
background-color: #d30102;
color: #002b36;
}
#pulseaudio {
}
#pulseaudio.muted {
background-color: #b58900;
color: #002b36;
}
#custom-pacman.good {
background-color: #859900;
color: #002b36;
}
#custom-pacman.info {
background-color: #268bd2;
color: #002b36;
}
#custom-pacman.important {
background-color: #d30102;
color: #002b36;
}
#tray {
}
#tray > .passive {
-gtk-icon-effect: dim;
}
#tray > .needs-attention {
-gtk-icon-effect: highlight;
background-color: #d30102;
}

3
.gitmodules vendored Normal file
View File

@@ -0,0 +1,3 @@
[submodule ".config/nvim/solarized.nvim"]
path = .config/nvim/themes/solarized.nvim
url = https://git.rhiobet.sh/rhiobet/solarized.nvim.git

View File

@@ -1,2 +1,7 @@
export JAVA_HOME=/usr/lib/jvm/$(archlinux-java get)
export GDK_BACKEND=x11
#export GDK_BACKEND=x11
export EDITOR=nvim
export XDG_CURRENT_DESKTOP=sway
export XDG_SESSION_TYPE=wayland
#export VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/intel_icd.x86_64.json:/usr/share/vulkan/icd.d/radeon_icd.x86_64.json

26
.zshrc
View File

@@ -13,12 +13,14 @@ compinit
export ZSH=/usr/share/oh-my-zsh
export ZSH_CUSTOM=/usr/share/zsh
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=10"
ZSH_THEME="af-magic"
plugins=(
archlinux
docker
docker-compose
fzf
git
systemd
vagrant
@@ -27,9 +29,31 @@ plugins=(
)
source $ZSH/oh-my-zsh.sh
bindkey '^R' history-incremental-pattern-search-backward
#bindkey '^R' history-incremental-pattern-search-backward
if [ -f ~/.bash_aliases ]; then
source ~/.bash_aliases
fi
eval $(thefuck --alias)
#alias discord="export GDK_BACKEND=wayland && discord-canary"
export MAVEN_OPTS="-Xmx2048m"
export _JAVA_AWT_WM_NONREPARENTING=1
# >>> mamba initialize >>>
# !! Contents within this block are managed by 'mamba init' !!
export MAMBA_EXE="/usr/bin/micromamba";
export MAMBA_ROOT_PREFIX="/home/rhiobet/.mamba";
__mamba_setup="$("$MAMBA_EXE" shell hook --shell zsh --prefix "$MAMBA_ROOT_PREFIX" 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__mamba_setup"
else
if [ -f "/home/rhiobet/.mamba/etc/profile.d/micromamba.sh" ]; then
. "/home/rhiobet/.mamba/etc/profile.d/micromamba.sh"
else
export PATH="/home/rhiobet/.mamba/bin:$PATH" # extra space after export prevents interference from conda init
fi
fi
unset __mamba_setup
# <<< mamba initialize <<<

View File

@@ -0,0 +1 @@
SUBSYSTEM=="sound", ACTION=="change", KERNEL=="card*", ATTRS{vendor}=="0x8086", ATTRS{device}=="0x9d71", ENV{ACP_PROFILE_SET}="noboost.conf"

View File

@@ -0,0 +1,4 @@
.include analog-input-internal-mic.conf
[Element Internal Mic Boost]
volume = off

View File

@@ -0,0 +1,4 @@
.include default.conf
[Mapping analog-stereo]
paths-input = analog-input-internal-mic-noboost

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 268 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 241 KiB

BIN
wallpapers/priscilla.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

BIN
wallpapers/ranni.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 MiB