Remote desktop, video playback issues
#6
Before I got my PinePhone I thought I could just run Barrier on both devices and it would be awesome, but no go. I could not get the devices to find each other.
So I tried KDE Connect and It lacked the all important clipboard sharing functionality Sad .

I decided that being able to share the clipboard would make the lack of desktop-sharing much more tolerable.
Sidenote: I connect to my phone (ssh) on one of 3 networks USB, Wifi or WifiHotspot so I have a script, SetHostRoute.sh,  to find which network the phone is connected.

Here is my clipboard sharing script:
PasteToMobian.sh
Code:
#!/bin/bash

tempFile=/tmp/tempHost.txt

# Uncomment to set ssh hostname manually
    # echo "ssh_hostname_here" > $tempFile

# Check if the temp file created by SetHostRoute.sh exists.
if [ -f "$tempFile" ]; then
    # Set tempFile contents as $hostRoute
    hostRoute=$(</tmp/tempHost.txt)
    # Make sure SetHostRoute.sh found mobian (via usb||wifi||hotspot)
    if [ $hostRoute != "notset" ]; then

        # Get the clipboard
        clipb="`xclip -o -sel clip`"
        # Unify file path formats (file vs. file path)
        clipc=${clipb/file:\/\//}

        # Check if clipboard contents are a file (or a path), if so scp the file to the mobian's home directory
        if [ -f  "$clipc" ]; then
            scp "$clipc" $hostRoute:/home/mobian/
            notify-send Clipboard2Mobian "$clipc
            Copied via $hostRoute"
        else
        # Clipboard contents are not a file, so.. Treat as text and copy to Mobian's clipboard (using a temp file to preserve all special characters)
            echo "$clipb" > ~/.clipSync.txt
            ssh $hostRoute wl-copy -n < ~/.clipSync.txt &
            rm ~/.clipSync.txt
            notify-send Clipboard2Mobian "Text Copied via
            $hostRoute"
        fi
    else
    # SetHostRoute.sh didn't find an ssh route and printed "notset" to the tempfile.
        notify-send Clipboard2Mobian "No Route to Mobian..."
    fi
else
    # SetHostRoute.sh has yet to execute (ie. no tempFile) so.. Run it and then re-run this script.
    notify-send Clipboard2Mobian "No Route to Mobian..."
    /home/mj/Scripts/SetHostRoute.sh &&
    sleep 5s
    /home/mj/Scripts/xClipboard/PasteToMobian.sh
fi


This script finds my phone on one of the 3 networks and writes the hostname to a temp file (It runs at startup or I re-run it if I switch networks):
SetRouteToMobian.sh

Code:
#!/bin/bash

notify-send Clipboard2Mobian "Finding a Route to Mobian..."
hostRoute="notset"
echo $hostRoute > /tmp/tempHost.txt

ping -q -c 1 10.66.0.1 > /dev/null
if [ $? -eq 0 ]; then
    hostRoute="mobianusb"
    echo $hostRoute > /tmp/tempHost.txt
    notify-send Clipboard2Mobian "$hostRoute Route Set!"
    else
        ping -q -c 1 192.168.3.108 > /dev/null
        if [ $? -eq 0 ]; then
            hostRoute="mobianwifi"
            echo $hostRoute > /tmp/tempHost.txt
            notify-send Clipboard2Mobian "$hostRoute Route Set!"
            else
                ping -q -c 1 10.42.0.1 > /dev/null
                if [ $? -eq 0 ]; then
                    hostRoute="mobianhotspot"
                    echo $hostRoute > /tmp/tempHost.txt
                    notify-send Clipboard2Mobian "$hostRoute Route Set!"
                    else
                        notify-send Clipboard2Mobian "...No Route To Mobian"
                fi
        fi
fi
It all works just fine but I'm curious if there is a better way to do this Smile

I'm also curious to see if clipboard sharing on the pinephone exists in some other form.

If anyone is interested I'll post the script for doing the reverse and copying from Pinephone's clipboard.

Cheers!
  Reply


Messages In This Thread
RE: Remote desktop, video playback issues - by MtnSk8 - 05-06-2021, 10:29 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Has anyone got briar-desktop running on mobian? vusra 5 3,041 06-19-2023, 03:02 PM
Last Post: vusra
  Modem Firmware Upgrade - Modem Busy - USB Issues biketool 10 4,828 09-23-2022, 05:15 AM
Last Post: biketool
  Sending Pinephone SMS from Desktop biketool 5 2,948 09-13-2022, 01:46 PM
Last Post: anonymous
  Lot of issues after flashing mobian to emmc with tow-boot benedikt55 5 2,680 08-30-2022, 01:14 PM
Last Post: benedikt55
  Telegram not as desktop app user641 0 797 08-05-2022, 08:45 AM
Last Post: user641
  Hardware VIdeo Acceleration on Mobian biketool 3 2,561 06-21-2022, 01:01 PM
Last Post: biketool
  Working video players? jojuma 10 4,630 06-10-2022, 01:13 AM
Last Post: as365n4
  Anyone tried Signal Desktop ragreenburg 20 14,301 05-23-2022, 04:41 AM
Last Post: Anna
  gpsd issues io. 5 3,051 05-07-2022, 03:31 AM
Last Post: wibble
  Issues with Mobian? Start here. tophneal 0 4,992 04-21-2022, 11:27 AM
Last Post: tophneal

Forum Jump:


Users browsing this thread: 1 Guest(s)