From a871ec1447d97e86bed14c5ccc5da0e3bec040be Mon Sep 17 00:00:00 2001 From: Asaki Yuki Date: Sat, 11 Apr 2026 02:14:49 +0700 Subject: [PATCH] add copy-public-url.sh --- configs/services-menu/copy-server-public-url.desktop | 10 ++++++++++ configs/services-menu/open-ghostty-here.desktop | 10 +++++----- configs/services-menu/open-with-nvim.desktop | 2 +- scripts/copy-public-url.sh | 12 ++++++++++++ 4 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 configs/services-menu/copy-server-public-url.desktop create mode 100755 scripts/copy-public-url.sh diff --git a/configs/services-menu/copy-server-public-url.desktop b/configs/services-menu/copy-server-public-url.desktop new file mode 100644 index 0000000..785d36c --- /dev/null +++ b/configs/services-menu/copy-server-public-url.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Type=Service +ServiceTypes=KonqPopupMenu/Plugin +MimeType=all/allfiles; +Actions=CopyPublicURL + +[Desktop Action CopyPublicURL] +Name=Copy location as URL +Icon=org.kde.plasma.clipboard +Exec=/etc/nixos/scripts/copy-public-url.sh "%F" \ No newline at end of file diff --git a/configs/services-menu/open-ghostty-here.desktop b/configs/services-menu/open-ghostty-here.desktop index f2e4926..0385aca 100644 --- a/configs/services-menu/open-ghostty-here.desktop +++ b/configs/services-menu/open-ghostty-here.desktop @@ -2,9 +2,9 @@ Type=Service ServiceTypes=KonqPopupMenu/Plugin MimeType=inode/directory -Actions=RunCodeDir +Actions=RunGhosttyDir -[Desktop Action RunCodeDir] -Name=Open with Nvim -Icon=nvim -Exec=ghostty +new-window --working-directory="~/.config" -e nvim . \ No newline at end of file +[Desktop Action RunGhosttyDir] +Name=Open Ghostty here +Icon=com.mitchellh.ghostty +Exec=ghostty +new-window --working-directory="%F" \ No newline at end of file diff --git a/configs/services-menu/open-with-nvim.desktop b/configs/services-menu/open-with-nvim.desktop index fc6fa87..f2e4926 100644 --- a/configs/services-menu/open-with-nvim.desktop +++ b/configs/services-menu/open-with-nvim.desktop @@ -7,4 +7,4 @@ Actions=RunCodeDir [Desktop Action RunCodeDir] Name=Open with Nvim Icon=nvim -Exec=antigravity %F \ No newline at end of file +Exec=ghostty +new-window --working-directory="~/.config" -e nvim . \ No newline at end of file diff --git a/scripts/copy-public-url.sh b/scripts/copy-public-url.sh new file mode 100755 index 0000000..10d8875 --- /dev/null +++ b/scripts/copy-public-url.sh @@ -0,0 +1,12 @@ +#!/bin/sh +str_path="$1" +search="asakiyuki@server.asakiyuki.com:15523/home/asakiyuki/PUBLIC/" + +prefix=${str_path%%"$search"*} +prefix_index=${#prefix} + +if [ $(expr length "$str_path") -gt $prefix_index ]; then + prefix_index=$(($prefix_index + $(expr length $search))) + output=${str_path:prefix_index} + wl-copy "https://static.asakiyuki.com/${output// /"%20"}" +fi \ No newline at end of file