change fn name

This commit is contained in:
Donaldttt
2022-06-18 03:38:15 -04:00
parent 05d8a16756
commit 2fbae37118
+18 -27
View File
@@ -1,11 +1,11 @@
# args: # args:
# $1: # $1:
# The IP address you want to query geo info for. # The IP address you want to query geo info for.
# If no argument supplied, the host machine's ip will # If no argument supplied, the host machine's ip will
# be used # be used
# doc for api: https://ip-api.com/docs/api # doc for api: https://ip-api.com/docs/api
ipinfo() ipinfo(){
{
api_str=http://ip-api.com/json/$1?fields=query,country,regionName,city,district,zip,isp,org,reverse,mobile,proxy,hosting api_str=http://ip-api.com/json/$1?fields=query,country,regionName,city,district,zip,isp,org,reverse,mobile,proxy,hosting
if ! hash python; then if ! hash python; then
curl $api_str curl $api_str
@@ -28,13 +28,13 @@ odict(){
# Linux specific functions # Linux specific functions
if [[ "$OSTYPE" == "linux-gnu"* ]]; then if [[ "$OSTYPE" == "linux-gnu"* ]]; then
change_wallpaper(){ set_wallpaper(){
local file=$1 local file=$1
# convert to abs path # convert to abs path
if [[ ! "$file" = /* ]]; then if [[ ! "$file" = /* ]]; then
file=$(pwd)/$1 file=$(pwd)/$1
fi fi
gsettings set org.gnome.desktop.background picture-uri file://$file gsettings set org.gnome.desktop.background picture-uri file://$file
} }
fi fi
@@ -42,26 +42,17 @@ fi
# Mac OSX specific functions # Mac OSX specific functions
if [[ "$OSTYPE" == "darwin"* ]]; then if [[ "$OSTYPE" == "darwin"* ]]; then
change_wallpaper(){ set_wallpaper(){
local file=$1 local file=$1
# convert to abs path # convert to abs path
if [[ ! "$file" = /* ]]; then if [[ ! "$file" = /* ]]; then
file=$(pwd)/$1 file=$(pwd)/$1
fi fi
# not working for all desktops apple_script_single_desk="tell application \"Finder\" to set desktop picture to POSIX file \"$file\""
#apple_script_all_desk=" \ osascript -e "$apple_script_single_desk"
# import AppKit; \ }
# let url = URL(fileURLWithPath: \"$file\"); \
# for screen in NSScreen.screens {
# try! NSWorkspace.shared.setDesktopImageURL(url, for: screen, options: [:]) \
# }"
#swift <<< $apple_script_all_desk
apple_script_single_desk="tell application \"Finder\" to set desktop picture to POSIX file \"$file\""
osascript -e "$apple_script_single_desk"
}
fi fi
# #