diff options
| -rw-r--r-- | ghostty/.config/ghostty/config | 2 | ||||
| -rw-r--r-- | hypr/.config/hypr/hyprland.conf | 69 | ||||
| -rw-r--r-- | nvim/.config/nvim/lua/config/keymaps.lua | 4 | ||||
| -rwxr-xr-x | scripts/.scripts/config_files.sh | 7 | ||||
| -rw-r--r-- | yazi/.config/yazi/keymap.toml | 5 | ||||
| -rw-r--r-- | yazi/.config/yazi/package.toml | 5 | ||||
| -rw-r--r-- | yazi/.config/yazi/plugins/mediainfo.yazi/DO_NOT_MODIFY_ANYTHING_IN_THIS_DIRECTORY | 0 | ||||
| -rw-r--r-- | yazi/.config/yazi/plugins/mediainfo.yazi/LICENSE | 19 | ||||
| -rw-r--r-- | yazi/.config/yazi/plugins/mediainfo.yazi/README.md | 29 | ||||
| -rw-r--r-- | yazi/.config/yazi/plugins/mediainfo.yazi/init.lua | 115 | ||||
| -rw-r--r-- | yazi/.config/yazi/yazi.toml | 5 | ||||
| -rw-r--r-- | zsh/.zshrc | 5 |
12 files changed, 194 insertions, 71 deletions
diff --git a/ghostty/.config/ghostty/config b/ghostty/.config/ghostty/config index 5cd013c..7c28f82 100644 --- a/ghostty/.config/ghostty/config +++ b/ghostty/.config/ghostty/config @@ -8,7 +8,7 @@ font-style = bold gtk-titlebar = false background-opacity = 0.6 confirm-close-surface = false -adjust-cell-height = 35% +adjust-cell-height = 10% unfocused-split-opacity = 1 diff --git a/hypr/.config/hypr/hyprland.conf b/hypr/.config/hypr/hyprland.conf index a4afae4..1c2cdb7 100644 --- a/hypr/.config/hypr/hyprland.conf +++ b/hypr/.config/hypr/hyprland.conf @@ -1,15 +1,3 @@ -# This is an example Hyprland config file. -# -# Refer to the wiki for more information. - -# -# Please note not all available settings / options are set here. -# For a full list, see the wiki -# -# info at https://wiki.hyprland.org/ -# See https://wiki.hyprland.org/Configuring/Monitors/ -# monitor=,preferred,auto,auto - # mirror two screens HDMI-A-1 to left of HDMI-A-2 # monitor=HDMI-A-1,1920x1080@60,0x0,1,mirror,HDMI-A-2 # monitor=,preferred,auto,1,mirror,HDMI-A-1 @@ -28,7 +16,6 @@ #monitor=eDP-1,addreserved,10,10,10,10 #workspace=eDP-1,1 -# See https://wiki.hyprland.org/Configuring/Keywords/ for more # Setting variables $mainMod = SUPER $localBin = $HOME/.local/bin @@ -44,7 +31,7 @@ $lock = $scriptsDir/lockscreen $colorpicker = $scriptsDir/colorpicker $wofi_beats = $scriptsDir/wofi-beats $files = thunar -$browser = brave +$browser = brave --ozone-platform-hint=auto $editor = nvim # Some default env vars @@ -231,62 +218,11 @@ bind = $mainMod, Return, exec, $term bind = $mainMod, B, exec, $browser bind = $mainMod, V, exec, pavucontrol -bind = CTRL ALT, A, exec, xfce4-appfinder -bind = CTRL ALT, C, exec, catfish -bind = CTRL ALT, B, exec, $files -bind = CTRL ALT, E, exec, archlinux-tweak-tool -bind = CTRL ALT, F, exec, firefox -bind = CTRL ALT, G, exec, chromium -no-default-browser-check -bind = CTRL ALT, I, exec, nitrogen -bind = CTRL ALT, K, exec, $scriptsDir/lockscreen -bind = CTRL ALT, L, exec, $scriptsDir/lockscreen -bind = CTRL ALT, NEXT, exec, conky-rotate -n -bind = CTRL ALT, P, exec, pamac-manager -bind = CTRL ALT, PREVIOUS, exec, conky-rotate -p bind = CTRL ALT, R, exec, rofi-theme-selector -bind = CTRL ALT, Return, exec, foot -bind = CTRL ALT, S, exec, spotify -bind = CTRL ALT, T, exec, $term -bind = CTRL ALT, U, exec, pavucontrol -bind = CTRL ALT, V, exec, vivaldi-stable -bind = CTRL ALT, W, exec, arcolinux-welcome-app - -bind = CTRL SHIFT, Escape, exec, $term --class btop -T btop -e btop -bind = CTRL ALT, END, exec, $term --class btop -T btop -e btop - -# change wallpaper -# bind = ALT, n, exec, $scriptsDir/changeWallpaper -# bind = ALT, p, exec, $scriptsDir/changeWallpaper -# bind = ALT, left, exec, $scriptsDir/changeWallpaper -# bind = ALT, right, exec, $scriptsDir/changeWallpaper -# bind = ALT, up, exec, $scriptsDir/changeWallpaperDesktop -# bind = ALT, down, exec, $scriptsDir/changeWallpaperDesktop - - -# effect -bind = ALT, g, exec, $scriptsDir/glassmorphismToggle -bind = ALT, F3, exec, xfce4-appfinder - -bind = , F12, exec, xfce4-terminal --drop-down - -bind = $mainMod SHIFT, M, exec, hyprctl dispatch splitratio -0.1 bind = $mainMod, M, fullscreen, 1 - -bind = $mainMod SHIFT, Y, exec, $term --class clock -T clock -e tty-clock -c -C 7 -r -s -f "%A, %B, %d" -#bind = $mainMod, D, layoutmsg, removemaster -bind = $mainMod, Escape, exec, hyprctl kill -bind = $mainMod, I, layoutmsg, addmaster -# bind = $mainMod, J, layoutmsg, cyclenext -# bind = $mainMod, K, layoutmsg, cycleprev - -bind = $mainMod, P, pseudo -bind = $mainMod CTRL, Return, layoutmsg, swapwithmaster bind = $mainMod, Space, exec, $scriptsDir/changeLayout bind = $mainMod, X, exec, archlinux-logout -bind = ALT, X, exec, nlogout -bind = ALT SHIFT, X, exec, nlogout -bind = $mainMod SHIFT, X, exec, arcolinux-powermenu # Mainmod + Function keys bind = $mainMod, F1, exec, $browser @@ -302,7 +238,6 @@ bind = $mainMod, F10, exec, spotify bind = $mainMod, d, exec, rofi -show run bind = $mainMod, o, exec, rofi -show drun bind = $mainMod, w, exec, rofi -show window -bind = $mainMod, a, exec, albert toggle # Special Keys bind = , xf86audioraisevolume, exec, $volume --inc @@ -425,8 +360,6 @@ bind = $mainMod SHIFT, 0, movetoworkspacesilent, 10 bind = $mainMod SHIFT, bracketleft, movetoworkspacesilent, -1 bind = $mainMod SHIFT, bracketright, movetoworkspacesilent, +1 -debug:disable_logs = false - # Personal scripts bind = $alt,b,exec, $HOME/.scripts/books.sh bind = $mainMod,p,exec, $HOME/.scripts/toggle_waybar.sh diff --git a/nvim/.config/nvim/lua/config/keymaps.lua b/nvim/.config/nvim/lua/config/keymaps.lua index 0f2944d..2bb7600 100644 --- a/nvim/.config/nvim/lua/config/keymaps.lua +++ b/nvim/.config/nvim/lua/config/keymaps.lua @@ -112,3 +112,7 @@ map("n", "-", "<cmd>Oil<CR>", { desc = "Open Oil.nvim", remap = true }) map("n", "<F2>", "<cmd> CompetiTest receive problem <CR>", { desc = "Receive test", remap = true }) map("n", "<F4>", "<cmd> CompetiTest run <CR>", { desc = "Run test", remap = true }) map("n", "<F5>", "<cmd> CompetiTest add_testcase <CR>", { desc = "Add test", remap = true }) + +-- Better end and start of line navigation +map("n", "g;", "$", { silent = true, remap = true }) +map("n", "gh", "^", { silent = true, remap = true }) diff --git a/scripts/.scripts/config_files.sh b/scripts/.scripts/config_files.sh index 63cfa47..5051304 100755 --- a/scripts/.scripts/config_files.sh +++ b/scripts/.scripts/config_files.sh @@ -10,7 +10,10 @@ configs=("aliases:$HOME/dotfiles/aliases/.aliases/aliases" "starship:$HOME/dotfiles/starship/.config/starship.toml" "tmux:$HOME/dotfiles/tmux/.tmux.conf" "zathura:$HOME/dotfiles/zathura/.config/zathura/zathurarc" - "zsh:$HOME/dotfiles/zsh/.zshrc") + "zsh:$HOME/dotfiles/zsh/.zshrc" + "yazi:$HOME/dotfiles/yazi/.config/yazi/keymap.toml" + "ghostty:$HOME/dotfiles/ghostty/.config/ghostty/config" +) configs=$(printf '%s\n' "${configs[@]}") @@ -33,4 +36,4 @@ choice=$(echo "$program_names" | $launcher) file=$(echo "$configs" | grep -w "$choice" | cut -d':' -f2) cwd=$(dirname $file) -ghostty -e nvim -c "cd $cwd" $file +kitty -e nvim -c "cd $cwd" $file diff --git a/yazi/.config/yazi/keymap.toml b/yazi/.config/yazi/keymap.toml index f01816a..a5105a4 100644 --- a/yazi/.config/yazi/keymap.toml +++ b/yazi/.config/yazi/keymap.toml @@ -7,3 +7,8 @@ desc = "Cd to College folder" on = [ "g", "p" ] run = "cd ~/programming/" desc = "Cd to ~/programming" + +[[manager.prepend_keymap]] +on = [ "g", "b" ] +run = "cd /mnt/Storage/omar/Books/" +desc = "Cd to Books" diff --git a/yazi/.config/yazi/package.toml b/yazi/.config/yazi/package.toml new file mode 100644 index 0000000..fe5ac43 --- /dev/null +++ b/yazi/.config/yazi/package.toml @@ -0,0 +1,5 @@ +[plugin] +deps = [{ use = "boydaihungst/mediainfo", rev = "ddfd5ec" }] + +[flavor] +deps = [] diff --git a/yazi/.config/yazi/plugins/mediainfo.yazi/DO_NOT_MODIFY_ANYTHING_IN_THIS_DIRECTORY b/yazi/.config/yazi/plugins/mediainfo.yazi/DO_NOT_MODIFY_ANYTHING_IN_THIS_DIRECTORY new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/yazi/.config/yazi/plugins/mediainfo.yazi/DO_NOT_MODIFY_ANYTHING_IN_THIS_DIRECTORY diff --git a/yazi/.config/yazi/plugins/mediainfo.yazi/LICENSE b/yazi/.config/yazi/plugins/mediainfo.yazi/LICENSE new file mode 100644 index 0000000..0399f1c --- /dev/null +++ b/yazi/.config/yazi/plugins/mediainfo.yazi/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2024 Lauri Niskanen + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/yazi/.config/yazi/plugins/mediainfo.yazi/README.md b/yazi/.config/yazi/plugins/mediainfo.yazi/README.md new file mode 100644 index 0000000..45d04be --- /dev/null +++ b/yazi/.config/yazi/plugins/mediainfo.yazi/README.md @@ -0,0 +1,29 @@ +# mediainfo.yazi + +<!--toc:start--> + +- [mediainfo.yazi](#mediainfoyazi) + - [Installation](#installation) + <!--toc:end--> + +This is a Yazi plugin for previewing media files. The preview shows thumbnail +using `ffmpeg` if available and media metadata using `mediainfo`. +Only for yazi >= 0.4 + +## Installation + +Install the plugin: + +```bash +ya pack -a boydaihungst/mediainfo +``` + +Create `~/.config/yazi/yazi.toml` and add: + +```toml +[plugin] +prepend_previewers = [ + { mime = "{image,audio,video}/*", run = "mediainfo"}, + { mime = "application/subrip", run = "mediainfo"}, +] +``` diff --git a/yazi/.config/yazi/plugins/mediainfo.yazi/init.lua b/yazi/.config/yazi/plugins/mediainfo.yazi/init.lua new file mode 100644 index 0000000..b583b06 --- /dev/null +++ b/yazi/.config/yazi/plugins/mediainfo.yazi/init.lua @@ -0,0 +1,115 @@ +local skip_labels = { + ["Complete name"] = true, + ["CompleteName_Last"] = true, + ["Unique ID"] = true, + ["File size"] = true, + ["Format/Info"] = true, + ["Codec ID/Info"] = true, + ["MD5 of the unencoded content"] = true, +} + +local M = {} +local suffix = "_mediainfo" + +local function read_mediainfo_cached_file(file_path) + -- Open the file in read mode + local file = io.open(file_path, "r") + + if file then + -- Read the entire file content + local content = file:read("*all") + file:close() + return content + end +end + +function M:peek(job) + local start, cache_img_url = os.clock(), ya.file_cache(job) + if not cache_img_url or self:preload(job) ~= 1 then + return + end + + local cache_img_url_no_skip = ya.file_cache({ file = job.file, skip = 0 }) + local cache_mediainfo_path = tostring(cache_img_url_no_skip) .. suffix + ya.sleep(math.max(0, PREVIEW.image_delay / 1000 + start - os.clock())) + local output = read_mediainfo_cached_file(cache_mediainfo_path) + + local lines = {} + + if output then + local i = 0 + for str in output:gmatch("[^\n]*") do + local label, value = str:match("(.*[^ ]) +: (.*)") + local line + + if label then + if not skip_labels[label] then + line = ui.Line({ + ui.Span(label .. ": "):style(ui.Style():bold()), + ui.Span(value):style(ui.Style():fg("blue")), + }) + end + elseif str ~= "General" then + line = ui.Line({ ui.Span(str):style(ui.Style():fg("green")) }) + end + + if line then + if i >= job.skip then + table.insert(lines, line) + end + + local max_width = math.max(1, job.area.w - 3) + i = i + math.max(1, math.ceil(line:width() / max_width)) + end + end + end + + local rendered_img_rect = ya.image_show(cache_img_url, job.area) + local image_height = rendered_img_rect and rendered_img_rect.h or 0 + ya.preview_widgets(job, { + ui.Text(lines) + :area(ui.Rect({ + x = job.area.x, + y = job.area.y + image_height, + w = job.area.w, + h = job.area.h - image_height, + })) + :wrap(ui.Text.WRAP), + }) +end + +function M:seek(job) + local h = cx.active.current.hovered + if h and h.url == job.file.url then + ya.manager_emit("peek", { + math.max(0, cx.active.preview.skip + job.units), + only_if = job.file.url, + }) + end +end + +function M:preload(job) + local video = require("video") + video = ya.dict_merge(video, { skip = job.skip, file = job.file }) + local cache_img_status = video:preload(job) + if cache_img_status ~= 1 then + return cache_img_status + end + + local cache_img_url_no_skip = ya.file_cache({ file = job.file, skip = 0 }) + local cache_mediainfo_url = Url(tostring(cache_img_url_no_skip) .. suffix) + + local cha = fs.cha(cache_mediainfo_url) + if cha and cha.len > 1000 then + return 1 + end + local cmd = "mediainfo" + local output, _ = Command(cmd):args({ tostring(job.file.url) }):stdout(Command.PIPED):output() + + return fs.write( + cache_mediainfo_url, + output and output.stdout or string.format("Failed to start `%s`, Do you have `%s` installed?", cmd, cmd) + ) and 1 or 2 +end + +return M diff --git a/yazi/.config/yazi/yazi.toml b/yazi/.config/yazi/yazi.toml new file mode 100644 index 0000000..8237360 --- /dev/null +++ b/yazi/.config/yazi/yazi.toml @@ -0,0 +1,5 @@ +[plugin] +prepend_previewers = [ + { mime = "{image,audio,video}/*", run = "mediainfo"}, + { mime = "application/subrip", run = "mediainfo"}, +] @@ -195,3 +195,8 @@ case ":$PATH:" in *) export PATH="$PNPM_HOME:$PATH" ;; esac # pnpm end + +. "$HOME/.atuin/bin/env" + +# Bind ctrl-r but not up arrow +eval "$(atuin init zsh --disable-up-arrow)" |
