From 176e6b36763f9efa31b2ecafd8b73b212e0195a2 Mon Sep 17 00:00:00 2001 From: Jed Reynolds Date: Thu, 21 Oct 2021 13:12:13 -0700 Subject: [PATCH] script that draws names on desktop background Signed-off-by: Jed Reynolds --- desktop-hostname.bash | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 desktop-hostname.bash diff --git a/desktop-hostname.bash b/desktop-hostname.bash new file mode 100755 index 00000000..6e81610f --- /dev/null +++ b/desktop-hostname.bash @@ -0,0 +1,28 @@ +#!/bin/bash +Q='"' +A="'" +function set_background() { + gsettings set "org.mate.background" "$1" "$2" +} + +SourceFile="/usr/share/backgrounds/mate/desktop/Ubuntu-Mate-Cold-no-logo.png" +DesktopFile="/home/lanforge/desktop.png" +my_version=`cat /var/www/html/installed-ver.txt` +my_hostname=`hostname` +my_dev=`ip ro sho | awk '/default via/{print $5}'` +my_ip=`ip ro sho | awk '/default via/{print$3}'` +my_mac=`ip a sho | grep -B1 "$my_dev" | awk '/ether /{print $2}'` + +X=220 +Y=150 +convert -pointsize 80 -fill cyan \ + -draw "text $X,$Y \"$my_hostname\"" \ + -draw "text $X,$(( Y + 75 )) \"$my_dev $my_ip\"" \ + -draw "text $X,$(( Y + 150 )) \"$my_mac\"" \ + $SourceFile \ + -scale 1600x900 \ + $DesktopFile + +set_background picture-filename ${A}${DesktopFile}${A} +set_background picture-options 'stretched' +#