add copy-public-url.sh
This commit is contained in:
parent
85d3134481
commit
a871ec1447
4 changed files with 28 additions and 6 deletions
10
configs/services-menu/copy-server-public-url.desktop
Normal file
10
configs/services-menu/copy-server-public-url.desktop
Normal file
|
|
@ -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"
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
Type=Service
|
Type=Service
|
||||||
ServiceTypes=KonqPopupMenu/Plugin
|
ServiceTypes=KonqPopupMenu/Plugin
|
||||||
MimeType=inode/directory
|
MimeType=inode/directory
|
||||||
Actions=RunCodeDir
|
Actions=RunGhosttyDir
|
||||||
|
|
||||||
[Desktop Action RunCodeDir]
|
[Desktop Action RunGhosttyDir]
|
||||||
Name=Open with Nvim
|
Name=Open Ghostty here
|
||||||
Icon=nvim
|
Icon=com.mitchellh.ghostty
|
||||||
Exec=ghostty +new-window --working-directory="~/.config" -e nvim .
|
Exec=ghostty +new-window --working-directory="%F"
|
||||||
|
|
@ -7,4 +7,4 @@ Actions=RunCodeDir
|
||||||
[Desktop Action RunCodeDir]
|
[Desktop Action RunCodeDir]
|
||||||
Name=Open with Nvim
|
Name=Open with Nvim
|
||||||
Icon=nvim
|
Icon=nvim
|
||||||
Exec=antigravity %F
|
Exec=ghostty +new-window --working-directory="~/.config" -e nvim .
|
||||||
12
scripts/copy-public-url.sh
Executable file
12
scripts/copy-public-url.sh
Executable file
|
|
@ -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
|
||||||
Reference in a new issue