diff --git a/.config/hypr/hyprland.conf b/.config/hypr/hyprland.conf index b63f44f..8f7c45a 100644 --- a/.config/hypr/hyprland.conf +++ b/.config/hypr/hyprland.conf @@ -56,7 +56,8 @@ exec-once = udiskie -t & exec-once = /usr/lib/polkit-kde-authentication-agent-1 exec-once = sleep 1; blueman-applet exec-once = hyprpaper -exec-once = [workspace special:music silent] supersonic-desktop +exec-once = sunsetr +exec-once = [workspace special:music silent] sleep 1; supersonic-desktop exec-once = dunst exec-once = waybar exec-once = hypridle @@ -69,10 +70,10 @@ exec-once = [workspace 2 silent] kitty --session ~/.config/kitty/session --liste exec-once = [workspace 2 silent] sleep 1; kitty newsboat exec-once = [workspace 6 silent] kitty btop exec-once = [workspace 6 silent] sleep 1; kitty -exec-once = [workspace 6 silent] sleep 2;kitty yazi +exec-once = [workspace 6 silent] sleep 2; kitty zsh -c "source ~/.zshrc;nnn -deUxH" exec-once = steam -silent exec-once = sleep 1; heroic --ozone-platform=wayland -exec-once = [workspace special:password silent] keepassxc +exec-once = [workspace special:password silent] keepassxc exec-once = [workspace special:scratchpad silent] signal-desktop --ozone-platform-hint=auto --enable-features=UseOzonePlatform,WaylandWindowDecorations exec-once = nextcloud exec-once = killall nextcloud @@ -145,68 +146,251 @@ misc { # Window rules -windowrule = workspace 3 silent,class:libreoffice-writer -windowrule = workspace 4 silent,class:gimp -windowrule = workspace 5 silent,class:virt-manager -windowrule = workspace special:email silent,class:tutanota-desktop -windowrule = workspace special:music silent,class:supersonic-desktop -windowrule = size 300 500,title:Friends List -windowrule = center,title:Steam -windowrule = float,class:steam -windowrule = size 1600 900, title:Steam -windowrule = center,class:heroic -windowrule = float,class:heroic -windowrule = size 1600 900, class:heroic -windowrule = center,class:discord -windowrule = float,class:discord -windowrule = size 1600 900, class:discord -windowrule = float,class:nmnet -windowrule = size 856 656, class:nmnet -windowrule = float,class:com.nextcloud.desktopclient.nextcloud -windowrule = move 1450 34,class:com.nextcloud.desktopclient.nextcloud -windowrule = float,class:openrgb -windowrule = size 1600 900,class:openrgb -windowrule = center,class:openrgb -windowrule = float,class:org.pulseaudio.pavucontrol -windowrule = move 1070 38,class:org.pulseaudio.pavucontrol -windowrule = float,title:Save File* -windowrule = size 1000 600,title:Save File* -windowrule = float,title:Open Files -windowrule = size 1000 600,title:Open Files -windowrule = float,title:Signal -windowrule = center,title:Signal -windowrule = size 1280 720,title:Signal -windowrule = float,class:org.keepassxc.KeePassXC -windowrule = size 800 600,class:org.keepassxc.KeePassXC -windowrule = center,class:org.keepassxc.KeePassXC -windowrule = float,class:mpv -windowrule = monitor DP-1,class:mpv -windowrule = size 600 400,class:mpv -windowrule = move 1310 670,class:mpv -windowrule = float,class:org.kde.polkit-kde-authentication-agent-1 -windowrule = float,class:alacarte -windowrule = float,class:piper -windowrule = float,class:nwg-look -windowrule = float,class:zenity -windowrule = float,class:galculator -windowrule = move 1592 740,class:galculator -windowrule = float,class:org.rncbc.qsynth -windowrule = float,class:qt5ct -windowrule = float,class:kvantummanager -windowrule = float,class:nm-connection-editor -windowrule = float,class:udiskie -windowrule = float,class:gsimplecal -windowrule = move 834 43,class:gsimplecal -windowrule = float,class:imv -windowrule = center,class:imv -windowrule = float,class:org.pwmt.zathura -windowrule = center,class:org.pwmt.zathura -windowrule = idleinhibit fullscreen, fullscreen:1 -windowrule = float,class:xdg-desktop-portal-gtk -windowrule = float,class:blueman-manager -windowrule = center,class:blueman-manager -windowrule = move 1310 40,class:blueman-manager -windowrule = size 600 900,class:blueman-manager +windowrule { + name = windowrule-1 + workspace = 3 silent + match:class = libreoffice-writer +} + +windowrule { + name = windowrule-2 + workspace = 4 silent + match:class = gimp +} + +windowrule { + name = windowrule-3 + workspace = 5 silent + match:class = virt-manager +} + +windowrule { + name = windowrule-4 + workspace = special:email silent + match:class = tutanota-desktop +} + +windowrule { + name = windowrule-5 + workspace = special:music silent + match:class = supersonic-desktop +} + +windowrule { + name = windowrule-6 + size = 300 500 + match:title = Friends List +} + +windowrule { + name = windowrule-7 + center = on + size = 1600 900 + match:title = Steam +} + +windowrule { + name = windowrule-8 + float = on + match:class = steam +} + +windowrule { + name = windowrule-9 + center = on + float = on + size = 1600 900 + match:class = heroic +} + +windowrule { + name = windowrule-10 + center = on + float = on + size = 1600 900 + match:class = discord +} + +windowrule { + name = windowrule-11 + float = on + size = 856 656 + match:class = nmnet +} + +windowrule { + name = windowrule-12 + float = on + move = (1450) (34) + match:class = com.nextcloud.desktopclient.nextcloud +} + +windowrule { + name = windowrule-13 + float = on + size = 1600 900 + center = on + match:class = openrgb +} + +windowrule { + name = windowrule-14 + float = on + move = (1070) (38) + match:class = org.pulseaudio.pavucontrol +} + +windowrule { + name = windowrule-15 + float = on + size = 1000 600 + match:title = Save File* +} + +windowrule { + name = windowrule-16 + float = on + size = 1000 600 + match:title = Open Files +} + +windowrule { + name = windowrule-17 + float = on + center = on + size = 1280 720 + match:title = Signal +} + +windowrule { + name = windowrule-18 + workspace = special:password silent + float = on + size = 800 600 + center = on + match:class = org.keepassxc.KeePassXC +} + +windowrule { + name = windowrule-19 + float = on + monitor = DP-1 + size = 600 400 + move = (1310) (670) + match:class = mpv +} + +windowrule { + name = windowrule-20 + float = on + match:class = org.kde.polkit-kde-authentication-agent-1 +} + +windowrule { + name = windowrule-21 + float = on + match:class = alacarte +} + +windowrule { + name = windowrule-22 + float = on + match:class = piper +} + +windowrule { + name = windowrule-23 + float = on + match:class = nwg-look +} + +windowrule { + name = windowrule-24 + float = on + match:class = zenity +} + +windowrule { + name = windowrule-25 + float = on + move = (1592) (740) + match:class = galculator +} + +windowrule { + name = windowrule-26 + float = on + match:class = org.rncbc.qsynth +} + +windowrule { + name = windowrule-27 + float = on + match:class = qt5ct +} + +windowrule { + name = windowrule-28 + float = on + match:class = kvantummanager +} + +windowrule { + name = windowrule-29 + float = on + match:class = nm-connection-editor +} + +windowrule { + name = windowrule-30 + float = on + size = 334 212 + center = on + match:class = udiskie +} + +windowrule { + name = windowrule-31 + float = on + move = (834) (43) + match:class = gsimplecal +} + +windowrule { + name = windowrule-32 + float = on + center = on + match:class = imv +} + +windowrule { + name = windowrule-33 + float = on + center = on + match:class = org.pwmt.zathura +} + +windowrule { + name = windowrule-34 + idle_inhibit = fullscreen + match:fullscreen = 1 +} + +windowrule { + name = windowrule-35 + float = on + match:class = xdg-desktop-portal-gtk +} + +windowrule { + name = windowrule-36 + float = on + center = on + move = (1310) (40) + size = 600 900 + match:class = blueman-manager +} + # Keywords @@ -392,7 +576,6 @@ general { col.inactive_border = rgba(44475aaa) col.nogroup_border = rgba(282a36dd) col.nogroup_border_active = rgb(bd93f9) rgb(44475a) 90deg - no_border_on_floating = false border_size = 2 } @@ -412,4 +595,10 @@ group { col.inactive = rgba(282a36dd) } } -windowrule = bordercolor rgb(ff5555),xwayland:1 # check if window is xwayland +windowrule { + name = windowrule-37 + border_color = rgb(ff5555) + match:xwayland = 1 # check if window is xwayland +} + + diff --git a/.config/hypr/hyprpaper.conf b/.config/hypr/hyprpaper.conf index b78173b..98cbfd9 100644 --- a/.config/hypr/hyprpaper.conf +++ b/.config/hypr/hyprpaper.conf @@ -1,16 +1,14 @@ -preload = /home/peter/.wallpapers/castlevania3.png -#if more than one preload is desired then continue to preload other backgrounds -preload = /home/peter/.wallpapers/castlevania4.png -# .. more preloads +wallpaper { + monitor = DP-1 + path = /home/peter/.wallpapers/castlevania3.png + fit_mode = cover +} -#set the default wallpaper(s) seen on initial workspace(s) --depending on the number of monitors used -wallpaper = DP-1,/home/peter/.wallpapers/castlevania3.png -#if more than one monitor in use, can load a 2nd image -wallpaper = DP-2,/home/peter/.wallpapers/castlevania4.png -# .. more monitors +wallpaper { + monitor = DP-2 + path = /home/peter/.wallpapers/castlevania4.png + fit_mode = cover +} #enable splash text rendering over the wallpaper splash = false - -#fully disable ipc -# ipc = off diff --git a/.config/yazi/flavors/dracula.yazi/flavor.toml b/.config/yazi/flavors/dracula.yazi/flavor.toml index 3dc0958..54b80da 100644 --- a/.config/yazi/flavors/dracula.yazi/flavor.toml +++ b/.config/yazi/flavors/dracula.yazi/flavor.toml @@ -5,6 +5,7 @@ [mgr] cwd = { fg = "#8be9fd" } +# TODO: remove # Hovered hovered = { reversed = true } preview_hovered = { underline = true } @@ -19,11 +20,6 @@ marker_cut = { fg = "#ff5555", bg = "#ff5555" } marker_marked = { fg = "#8be9fd", bg = "#8be9fd" } marker_selected = { fg = "#f1fa8c", bg = "#f1fa8c" } -# Tab -tab_active = { reversed = true } -tab_inactive = {} -tab_width = 1 - # Count count_copied = { fg = "#282a36", bg = "#50fa7b" } count_cut = { fg = "#282a36", bg = "#ff5555" } @@ -75,8 +71,8 @@ perm_exec = { fg = "#50fa7b" } # Progress progress_label = { fg = "#ffffff", bold = true } -progress_normal = { fg = "#bd93f9", bg = "#63667d" } -progress_error = { fg = "#ff5555", bg = "#63667d" } +progress_normal = { fg = "#50fa7b", bg = "#63667d" } +progress_error = { fg = "#f1fa8c", bg = "#ff5555" } # : }}} @@ -115,7 +111,7 @@ border = { fg = "#bd93f9" } [tasks] border = { fg = "#bd93f9" } title = {} -hovered = { fg = "#ff79c6", underline = true } +hovered = { fg = "#ff79c6", bold = true } # : }}} @@ -144,7 +140,18 @@ footer = { fg = "#44475a", bg = "#f8f8f2" } # : }}} -# : Notify {{{ +# : Spotter {{{ + +[spot] +border = { fg = "#bd93f9" } +title = { fg = "#bd93f9" } +tbl_col = { fg = "#8be9fd" } +tbl_cell = { fg = "#ff79c6", bg = "#63667d" } + +# : }}} + + +# : Notification {{{ [notify] title_info = { fg = "#50fa7b" } @@ -159,19 +166,20 @@ title_error = { fg = "#ff5555" } [filetype] rules = [ - # Images + # Image { mime = "image/*", fg = "#8be9fd" }, - # Media { mime = "{audio,video}/*", fg = "#f1fa8c" }, - - # Archives + # Archive { mime = "application/{zip,rar,7z*,tar,gzip,xz,zstd,bzip*,lzma,compress,archive,cpio,arj,xar,ms-cab*}", fg = "#ff79c6" }, - - # Documents + # Document { mime = "application/{pdf,doc,rtf}", fg = "#50fa7b" }, - + # Virtual file system + { mime = "vfs/{absent,stale}", fg = "#8998c9" }, # Fallback + { url = "*", fg = "#f8f8f2" }, + { url = "*/", fg = "#bd93f9" }, + # TODO: remove { name = "*", fg = "#f8f8f2" }, { name = "*/", fg = "#bd93f9" } ] diff --git a/.config/yazi/init.lua b/.config/yazi/init.lua index 7e64fb6..6d08f3f 100644 --- a/.config/yazi/init.lua +++ b/.config/yazi/init.lua @@ -125,6 +125,4 @@ require("yatline"):setup({ }, }) -- yatline-tab-path --- yatline-githead -require("yatline-githead"):setup() diff --git a/.config/yazi/plugins/chmod.yazi/main.lua b/.config/yazi/plugins/chmod.yazi/main.lua index a50a864..a4dde67 100644 --- a/.config/yazi/plugins/chmod.yazi/main.lua +++ b/.config/yazi/plugins/chmod.yazi/main.lua @@ -1,4 +1,4 @@ ---- @since 25.5.31 +--- @since 25.12.29 local selected_or_hovered = ya.sync(function() local tab, paths = cx.active, {} @@ -11,6 +11,15 @@ local selected_or_hovered = ya.sync(function() return paths end) +local function fail(s, ...) + ya.notify { + title = "Chmod", + content = string.format(s, ...), + level = "error", + timeout = 5, + } +end + return { entry = function() ya.emit("escape", { visual = true }) @@ -23,20 +32,16 @@ return { local value, event = ya.input { title = "Chmod:", pos = { "top-center", y = 3, w = 40 }, - position = { "top-center", y = 3, w = 40 }, -- TODO: remove } if event ~= 1 then return end - local status, err = Command("chmod"):arg(value):arg(urls):spawn():wait() - if not status or not status.success then - ya.notify { - title = "Chmod", - content = string.format("Chmod on selected files failed, error: %s", status and status.code or err), - level = "error", - timeout = 5, - } + local output, err = Command("chmod"):arg(value):arg(urls):stderr(Command.PIPED):output() + if not output then + fail("Failed to run chmod: %s", err) + elseif not output.status.success then + fail("Chmod failed with stderr:\n%s", output.stderr:gsub("^chmod:%s*", "")) end end, } diff --git a/.config/yazi/plugins/git.yazi/README.md b/.config/yazi/plugins/git.yazi/README.md index 96a87a8..23b3bbb 100644 --- a/.config/yazi/plugins/git.yazi/README.md +++ b/.config/yazi/plugins/git.yazi/README.md @@ -22,19 +22,19 @@ And register it as fetchers in your `~/.config/yazi/yazi.toml`: ```toml [[plugin.prepend_fetchers]] -id = "git" -name = "*" -run = "git" +id = "git" +url = "*" +run = "git" [[plugin.prepend_fetchers]] -id = "git" -name = "*/" -run = "git" +id = "git" +url = "*/" +run = "git" ``` ## Advanced -> [!NOTE] +> [!NOTE] > The following configuration must be put before `require("git"):setup()` You can customize the [Style](https://yazi-rs.github.io/docs/plugins/layout#style) of the status sign with: diff --git a/.config/yazi/plugins/git.yazi/main.lua b/.config/yazi/plugins/git.yazi/main.lua index e6b3a36..71c5429 100644 --- a/.config/yazi/plugins/git.yazi/main.lua +++ b/.config/yazi/plugins/git.yazi/main.lua @@ -1,4 +1,4 @@ ---- @since 25.5.31 +--- @since 25.12.29 local WINDOWS = ya.target_family() == "windows" @@ -125,12 +125,7 @@ local add = ya.sync(function(st, cwd, repo, changed) st.repos[repo][path] = code end end - -- TODO: remove this - if ui.render then - ui.render() - else - ya.render() - end + ui.render() end) ---@param cwd string @@ -142,12 +137,7 @@ local remove = ya.sync(function(st, cwd) return end - -- TODO: remove this - if ui.render then - ui.render() - else - ya.render() - end + ui.render() st.dirs[cwd] = nil if not st.repos[repo] then return @@ -189,8 +179,12 @@ local function setup(st, opts) } Linemode:children_add(function(self) + if not self._file.in_current then + return "" + end + local url = self._file.url - local repo = st.dirs[tostring(url.base)] + local repo = st.dirs[tostring(url.base or url.parent)] local code if repo then code = repo == CODES.excluded and CODES.ignored or st.repos[repo][tostring(url):sub(#repo + 2)] @@ -208,7 +202,7 @@ end ---@type UnstableFetcher local function fetch(_, job) - local cwd = job.files[1].url.base + local cwd = job.files[1].url.base or job.files[1].url.parent local repo = root(cwd) if not repo then remove(tostring(cwd)) diff --git a/.config/yazi/plugins/ouch.yazi/README.md b/.config/yazi/plugins/ouch.yazi/README.md index 571cefb..027f0d1 100644 --- a/.config/yazi/plugins/ouch.yazi/README.md +++ b/.config/yazi/plugins/ouch.yazi/README.md @@ -35,26 +35,35 @@ Make sure you have [ouch](https://github.com/ouch-org/ouch) installed and in you For archive preview, add this to your `yazi.toml`: ```toml -[plugin] -prepend_previewers = [ - # Archive previewer - { mime = "application/*zip", run = "ouch" }, - { mime = "application/x-tar", run = "ouch" }, - { mime = "application/x-bzip2", run = "ouch" }, - { mime = "application/x-7z-compressed", run = "ouch" }, - { mime = "application/x-rar", run = "ouch" }, - { mime = "application/vnd.rar", run = "ouch" }, - { mime = "application/x-xz", run = "ouch" }, - { mime = "application/xz", run = "ouch" }, - { mime = "application/x-zstd", run = "ouch" }, - { mime = "application/zstd", run = "ouch" }, - { mime = "application/java-archive", run = "ouch" }, -] +[[plugin.prepend_previewers]] +mime = "application/{*zip,tar,bzip2,7z*,rar,xz,zstd,java-archive}" +run = "ouch" ``` Now go to an archive on Yazi, you should see the archive's content in the preview pane. You can use `J` and `K` to roll up and down the preview. -If you want to change the icon or the style of text, you can modify the `peek` function in `init.lua` file (all of them are stored in the `lines` variable). +#### Customization + +Previews can be customized by adding extra arguments in the `run` string: + +```toml +[plugin] +prepend_previewers = [ + # Change the top-level archive icon + { ..., run = "ouch --archive-icon='🗄️ '" }, + # Or remove it by setting it to '' + { ..., run = "ouch --archive-icon=''" }, + + # Enable file icons + { ..., run = "ouch --show-file-icons" }, + + # Disable tree view + { ..., run = "ouch --list-view" }, + + # These can be combined + { ..., run = "ouch --archive-icon='🗄️ ' --show-file-icons --list-view" }, +] +``` ### Compression For compession, add this to your `keymap.toml`: diff --git a/.config/yazi/plugins/ouch.yazi/main.lua b/.config/yazi/plugins/ouch.yazi/main.lua index 4b6a739..a45ad3e 100644 --- a/.config/yazi/plugins/ouch.yazi/main.lua +++ b/.config/yazi/plugins/ouch.yazi/main.lua @@ -1,15 +1,50 @@ local M = {} +-- Extract the tree prefix (if any) from a line +local function get_tree_prefix(line) + local _, prefix_len = line:find("─ ", 1, true) + if prefix_len then + return line:sub(1, prefix_len) + else + return "" + end +end + +-- Add a filetype icon to a line +local function line_with_icon(line) + line = line:gsub("[\r\n]+$", "") -- Trailing newlines mess with filetype detection + + local tree_prefix = get_tree_prefix(line) + local url = line:sub(#tree_prefix + 1) + local icon = File({ + url = Url(url), + cha = Cha { + mode = tonumber(url:sub(-1) == "/" and "40700" or "100644", 8), + kind = url:sub(-1) == "/" and 1 or 0, -- For Yazi <25.9.x compatibility + } + }):icon() + + if icon then + line = ui.Line { tree_prefix, ui.Span(icon.text .. " "):style(icon.style), url } + end + + return line +end + function M:peek(job) - local child = Command("ouch") - :arg({ "l", "-t", "-y", tostring(job.file.url) }) + local cmd = Command("ouch"):arg("l") + if not job.args.list_view then + cmd:arg("-t") + end + cmd:arg({ "-y", tostring(job.file.url) }) :stdout(Command.PIPED) :stderr(Command.PIPED) - :spawn() + + local child = cmd:spawn() local limit = job.area.h + local archive_icon = job.args.archive_icon or "\u{1f4c1} " local file_name = string.match(tostring(job.file.url), ".*[/\\](.*)") - local lines = string.format("\u{1f4c1} %s\n", file_name) - local num_lines = 1 + local lines = { string.format(" %s%s", archive_icon, file_name) } local num_skip = 0 repeat local line, event = child:read_line() @@ -21,19 +56,29 @@ function M:peek(job) if line:find('Archive', 1, true) ~= 1 and line:find('[INFO]', 1, true) ~= 1 then if num_skip >= job.skip then - lines = lines .. line - num_lines = num_lines + 1 + if job.args.show_file_icons then + if line:find ('[ERROR]', 1, true) == 1 then + -- On error, disable file icons for the rest of the output + job.args.show_file_icons = false + elseif line:find ('[WARNING]', 1, true) ~= 1 then + -- Show icons for non-warning lines only + line = line_with_icon(line) + end + end + + line = ui.Line { " ", line } -- One space padding + table.insert(lines, line) else num_skip = num_skip + 1 end end - until num_lines >= limit + until #lines >= limit child:start_kill() - if job.skip > 0 and num_lines < limit then + if job.skip > 0 and #lines < limit then ya.emit( "peek", - { tostring(math.max(0, job.skip - (limit - num_lines))), only_if = tostring(job.file.url), upper_bound = "" } + { tostring(math.max(0, job.skip - (limit - #lines))), only_if = tostring(job.file.url), upper_bound = "" } ) else ya.preview_widget(job, { ui.Text(lines):area(job.area) }) diff --git a/.config/yazi/plugins/yatline-githead.yazi/main.lua b/.config/yazi/plugins/yatline-githead.yazi/main.lua deleted file mode 100644 index 714358a..0000000 --- a/.config/yazi/plugins/yatline-githead.yazi/main.lua +++ /dev/null @@ -1,320 +0,0 @@ ----@diagnostic disable: undefined-global - -local save = ya.sync(function(this, cwd, output) - if cx.active.current.cwd == Url(cwd) then - this.output = output - ya.render() - end -end) - -return { - setup = function(this, options) - options = options or {} - - local config = { - show_branch = options.show_branch == nil and true or options.show_branch, - branch_prefix = options.branch_prefix or "on", - branch_symbol = options.branch_symbol or "", - branch_borders = options.branch_borders or "()", - - commit_symbol = options.commit_symbol or "@", - - show_behind_ahead = options.behind_ahead == nil and true or options.behind_ahead, - behind_symbol = options.behind_symbol or "⇣", - ahead_symbol = options.ahead_symbol or "⇡", - - show_stashes = options.show_stashes == nil and true or options.show_stashes, - stashes_symbol = options.stashes_symbol or "$", - - show_state = options.show_state == nil and true or options.show_state, - show_state_prefix = options.show_state_prefix == nil and true or options.show_state_prefix, - state_symbol = options.state_symbol or "~", - - show_staged = options.show_staged == nil and true or options.show_staged, - staged_symbol = options.staged_symbol or "+", - - show_unstaged = options.show_unstaged == nil and true or options.show_unstaged, - unstaged_symbol = options.unstaged_symbol or "!", - - show_untracked = options.show_untracked == nil and true or options.show_untracked, - untracked_symbol = options.untracked_symbol or "?", - } - - if options.theme then - options = options.theme - end - - local theme = { - prefix_color = options.prefix_color or "white", - branch_color = options.branch_color or "blue", - commit_color = options.commit_color or "bright magenta", - behind_color = options.behind_color or "bright magenta", - ahead_color = options.ahead_color or "bright magenta", - stashes_color = options.stashes_color or "bright magenta", - state_color = options.state_color or "red", - staged_color = options.staged_color or "bright yellow", - unstaged_color = options.unstaged_color or "bright yellow", - untracked_color = options.untracked_color or "bright blue", - } - - local function get_branch(status) - local branch = status:match("On branch (%S+)") - - if branch == nil then - local commit = status:match("onto (%S+)") or status:match("detached at (%S+)") - - if commit == nil then - return "" - else - local branch_prefix = config.branch_prefix == "" and " " or " " .. config.branch_prefix .. " " - local commit_prefix = config.commit_symbol == "" and "" or config.commit_symbol - - return { "commit", branch_prefix .. commit_prefix, commit } - end - else - local left_border = config.branch_borders:sub(1, 1) - local right_border = config.branch_borders:sub(2, 2) - - local branch_string = "" - - if config.branch_symbol == "" then - branch_string = left_border .. branch .. right_border - else - branch_string = left_border .. config.branch_symbol .. " " .. branch .. right_border - end - - local branch_prefix = config.branch_prefix == "" and " " or " " .. config.branch_prefix .. " " - - return { "branch", branch_prefix, branch_string } - end - end - - local function get_behind_ahead(status) - local diverged_ahead, diverged_behind = status:match("have (%d+) and (%d+) different") - if diverged_ahead and diverged_behind then - return { " " .. config.behind_symbol .. diverged_behind, config.ahead_symbol .. diverged_ahead } - else - local behind = status:match("behind %S+ by (%d+) commit") - local ahead = status:match("ahead of %S+ by (%d+) commit") - if ahead then - return { "", " " .. config.ahead_symbol .. ahead } - elseif behind then - return { " " .. config.behind_symbol .. behind, "" } - else - return "" - end - end - end - - local function get_stashes(status) - local stashes = tonumber(status:match("Your stash currently has (%S+)")) - - return stashes ~= nil and " " .. config.stashes_symbol .. stashes or "" - end - - local function get_state(status) - local result = status:match("Unmerged paths:%s*(.-)%s*\n\n") - if result then - local filtered_result = result:gsub("^[%s]*%b()[%s]*", ""):gsub("^[%s]*%b()[%s]*", "") - - local unmerged = 0 - for line in filtered_result:gmatch("[^\r\n]+") do - if line:match("%S") then - unmerged = unmerged + 1 - end - end - - local state_name = "" - - if config.show_state_prefix then - if status:find("git merge") then - state_name = "merge " - elseif status:find("git cherry%-pick") then - state_name = "cherry " - elseif status:find("git rebase") then - state_name = "rebase " - - if status:find("done") then - local done = status:match("%((%d+) com.- done%)") or "" - state_name = state_name .. done .. "/" .. unmerged .. " " - end - else - state_name = "" - end - end - - return " " .. state_name .. config.state_symbol .. unmerged - else - return "" - end - end - - local function get_staged(status) - local result = status:match("Changes to be committed:%s*(.-)%s*\n\n") - if result then - local filtered_result = result:gsub("^[%s]*%b()[%s]*", "") - - local staged = 0 - for line in filtered_result:gmatch("[^\r\n]+") do - if line:match("%S") then - staged = staged + 1 - end - end - - return " " .. config.staged_symbol .. staged - else - return "" - end - end - - local function get_unstaged(status) - local result = status:match("Changes not staged for commit:%s*(.-)%s*\n\n") - if result then - local filtered_result = result:gsub("^[%s]*%b()[\r\n]*", ""):gsub("^[%s]*%b()[\r\n]*", "") - - local unstaged = 0 - for line in filtered_result:gmatch("[^\r\n]+") do - if line:match("%S") then - unstaged = unstaged + 1 - end - end - - return " " .. config.unstaged_symbol .. unstaged - else - return "" - end - end - - local function get_untracked(status) - local result = status:match("Untracked files:%s*(.-)%s*\n\n") - if result then - local filtered_result = result:gsub("^[%s]*%b()[\r\n]*", "") - - local untracked = 0 - for line in filtered_result:gmatch("[^\r\n]+") do - if line:match("%S") then - untracked = untracked + 1 - end - end - - return " " .. config.untracked_symbol .. untracked - else - return "" - end - end - - function Header:githead() - local status = this.output - - local branch_array = get_branch(status) - local prefix = ui.Span(config.show_branch and branch_array[2] or ""):fg(theme.prefix_color) - local branch = ui.Span(config.show_branch and branch_array[3] or "") - :fg(branch_array[1] == "commit" and theme.commit_color or theme.branch_color) - local behind_ahead = get_behind_ahead(status) - local behind = ui.Span(config.show_behind_ahead and behind_ahead[1] or ""):fg(theme.behind_color) - local ahead = ui.Span(config.show_behind_ahead and behind_ahead[2] or ""):fg(theme.ahead_color) - local stashes = ui.Span(config.show_stashes and get_stashes(status) or ""):fg(theme.stashes_color) - local state = ui.Span(config.show_state and get_state(status) or ""):fg(theme.state_color) - local staged = ui.Span(config.show_staged and get_staged(status) or ""):fg(theme.staged_color) - local unstaged = ui.Span(config.show_unstaged and get_unstaged(status) or ""):fg(theme.unstaged_color) - local untracked = ui.Span(config.show_untracked and get_untracked(status) or ""):fg(theme.untracked_color) - - return ui.Line({ prefix, branch, behind, ahead, stashes, state, staged, unstaged, untracked }) - end - - Header:children_add(Header.githead, 2000, Header.LEFT) - - local callback = function() - local cwd = cx.active.current.cwd - - ya.emit("plugin", { - this._id, - ya.quote(tostring(cwd), true), - }) - end - - ps.sub("cd", callback) - ps.sub("rename", callback) - ps.sub("bulk", callback) - ps.sub("move", callback) - ps.sub("trash", callback) - ps.sub("delete", callback) - ps.sub("tab", callback) - - if Yatline ~= nil then - function Yatline.coloreds.get:githead() - local status = this.output - local githead = {} - - if not status then - return githead - end - - local branch = config.show_branch and get_branch(status) or "" - if branch ~= nil and branch ~= "" then - table.insert(githead, { branch[2], theme.prefix_color }) - if branch[1] == "commit" then - table.insert(githead, { branch[3], theme.commit_color }) - else - table.insert(githead, { branch[3], theme.branch_color }) - end - end - - local behind_ahead = config.show_behind_ahead and get_behind_ahead(status) or "" - if behind_ahead ~= nil and behind_ahead ~= "" then - if behind_ahead[1] ~= nil and behind_ahead[1] ~= "" then - table.insert(githead, { behind_ahead[1], theme.behind_color }) - elseif behind_ahead[2] ~= nil and behind_ahead[2] ~= "" then - table.insert(githead, { behind_ahead[2], theme.ahead_color }) - end - end - - local stashes = config.show_stashes and get_stashes(status) or "" - if stashes ~= nil and stashes ~= "" then - table.insert(githead, { stashes, theme.stashes_color }) - end - - local state = config.show_state and get_state(status) or "" - if state ~= nil and state ~= "" then - table.insert(githead, { state, theme.state_color }) - end - - local staged = config.show_staged and get_staged(status) or "" - if staged ~= nil and staged ~= "" then - table.insert(githead, { staged, theme.staged_color }) - end - - local unstaged = config.show_unstaged and get_unstaged(status) or "" - if unstaged ~= nil and unstaged ~= "" then - table.insert(githead, { unstaged, theme.unstaged_color }) - end - - local untracked = config.show_untracked and get_untracked(status) or "" - if untracked ~= nil and untracked ~= "" then - table.insert(githead, { untracked, theme.untracked_color }) - end - - if #githead == 0 then - return "" - else - table.insert(githead, { " ", theme.prefix_color }) - return githead - end - end - end - end, - - entry = function(_, job) - local args = job.args or job - local command = Command("git") - :arg({ "status", "--ignore-submodules=dirty", "--branch", "--show-stash", "--ahead-behind" }) - :cwd(args[1]) - :env("LANGUAGE", "en_US.UTF-8") - :stdout(Command.PIPED) - local output = command:output() - - if output then - save(args[1], output.stdout) - end - end, -} diff --git a/.gitignore b/.gitignore index 7a66dd0..65df513 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ cache.db.lock /home/peter/docker/containers/homepage/logs /home/peter/docker/containers/homepage/custom.css /home/peter/docker/containers/homepage/custom.js +geo.toml diff --git a/.zprofile b/.zprofile index 34e7c3e..15cc21d 100644 --- a/.zprofile +++ b/.zprofile @@ -1,7 +1,8 @@ if [ -z "${DISPLAY}" ] && [ "${XDG_VTNR}" -eq 1 ]; then - exec Hyprland + exec start-hyprland fi # Created by `pipx` on 2024-01-02 21:02:32 export PATH="$PATH:/home/peter/.local/bin" export XDG_DATA_DIRS="/var/lib/flatpak/exports/share:/home/peter/.local/share/flatpak/exports/share:$XDG_DATA_DIRS" +export NNN_FCOLORS="D4DEB778E79F9F67D2E5E5D2" diff --git a/.zshrc b/.zshrc index 4224afd..91e7dd3 100644 --- a/.zshrc +++ b/.zshrc @@ -50,20 +50,20 @@ eval "$(starship init zsh)" # 7. yazi wrapper -function y() { - local tmp="$(mktemp -t "yazi-cwd.XXXXXX")" cwd - yazi "$@" --cwd-file="$tmp" - if cwd="$(command cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then - builtin cd -- "$cwd" - fi - rm -f -- "$tmp" -} +#function y() { +# local tmp="$(mktemp -t "yazi-cwd.XXXXXX")" cwd +# yazi "$@" --cwd-file="$tmp" +# if cwd="$(command cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then +# builtin cd -- "$cwd" +# fi +# rm -f -- "$tmp" +#} # 8. Aliases # 8.1 zsh aliases -alias ls='yazi' +alias ls='nnn -deUxH' alias aurdir='cd /home/peter/Downloads/AUR' alias gitdir='cd /home/peter/Downloads/git' alias notesdir='cd /home/peter/Nextcloud/Notes' @@ -291,3 +291,15 @@ bindkey -M vicmd 'j' history-substring-search-down # 16. pipx stuff export PATH="$PATH:/home/peter/.local/bin" + +# 16. zsh stuff +export NNN_FCOLORS="D4DEB778E79F9F67D2E5E5D2" +export NNN_TRASH=1 +export NNN_ARCHIVE="\\.(7z|a|ace|alz|arc|arj|bz|bz2|cab|cpio|deb|gz|jar|lha|lz|lzh|lzma|lzo|rar|rpm|rz|t7z|tar|tbz|tbz2|tgz|tlz|txz|tZ|tzo|war|xpi|xz|Z|zip)$" +export NNN_PLUG='p:preview-tui;c:x2sel' +export SPLIT='h' +export NNN_FIFO='/tmp/nnn.fifo' +export NNN_BMS='d:~/Downloads/;u:~/;b:/mnt/Backups;g:/media/Games;s:/mnt/SSD;n:~/Nextcloud;c:~/.config;r:/run/media;a:~/Downloads/AUR;!:~/.bin/sh;t:~/.local/share/Trash/files;y:/home/peter/Sync' +export VISUAL='vim' +# If not running interactively, don't do anything +[[ $- != *i* ]] && return