pinephone-scripts

Scripts and small applications for the PinePhone
git clone https://src.jayvii.de/pub/pinephone-scripts.git
Log | Files | Refs | README | LICENSE

commit 7e0da4a2ed0220be1965553e81401dde9e69bed1
parent f83312fa63a7e06878058ba82b112994960290be
Author: JayVii <jayvii@posteo.de>
Date:   Sun, 19 Sep 2021 22:40:46 +0200

WIP: new projects

Diffstat:
Amconnect-yad/mconnect-yad.sh | 53+++++++++++++++++++++++++++++++++++++++++++++++++++++
Asettheme/set_theme.sh | 20++++++++++++++++++++
2 files changed, 73 insertions(+), 0 deletions(-)

diff --git a/mconnect-yad/mconnect-yad.sh b/mconnect-yad/mconnect-yad.sh @@ -0,0 +1,53 @@ +#!/usr/bin/env bash + +if [[ -d `whereis mconnectctl | awk '{ print $2 }'` ]]; then + echo "[FAIL] mconnect and mconnectctl need to be installed." + exit 1; +fi + +if [[ -d `pidof mconnect` ]]; then + echo "[FAIL] mconnect needs to be running: \"mconnect -d\"." + exit 2; +fi + +DEVICES=`mconnectctl list-devices | \ + grep "/org/mconnect/device/" | \ + sed -e 's/^.*\/org\/mconnect\/device\///g' | \ + tr '\n' ';'` + +CHOICE=`yad --title="MConnect" \ + --form \ + --item-separator=";" \ + --field="Device:CBE" "${DEVICES}" \ + --field="Text:TEXT" \ + --field="File:FL" \ + --field="Allow Device:CHK"` + +CH_DEV=`echo $CHOICE | cut -d "|" -f1 | awk '{ print $1 }'` +CH_TXT=`echo $CHOICE | cut -d "|" -f2` +CH_DAT=`echo $CHOICE | cut -d "|" -f3` +CH_ALW=`echo $CHOICE | cut -d "|" -f4` + +if [[ "$CH_ALW" == "TRUE" ]]; then + mconnectctl allow-device /org/mconnect/device/${CH_DEV} +fi + +IS_URL=FALSE +if [[ -d "$CH_TXT" ]]; then + if [[ ! -d `echo "$CH_TXT" | grep "^(http|mailto:)"` ]]; then + IS_URL=TRUE + fi +fi + +if [[ $IS_URL == TRUE ]]; then + mconnectctl share-url /org/mconnect/device/${CH_DEV} "$CH_TXT" +elif [[ "$CH_TXT" != "" ]]; then + mconnectctl share-text /org/mconnect/device/${CH_DEV} "$CH_TXT" +elif [[ "$CH_DAT" != "" ]]; then + mconnectctl share-file /org/mconnect/device/${CH_DEV} "$CH_DAT" +else + echo "[FAIL] Nothing to be shared..." +fi + +exit 0; + diff --git a/settheme/set_theme.sh b/settheme/set_theme.sh @@ -0,0 +1,20 @@ +# Copyright (C) 2020 Jan "JayVii" +# Author 2020 Jan "JayVii" <jayvii [AT] posteo [DOT] de> +# SPDX-License-Identifier: gpl-3.0 +# About this header: <https://reuse.software> + +# default paths +GTK_DIRS="/usr/share/themes/ $HOME/.themes/" +ICON_DIRS="/usr/share/icons/ $HOME/.icons/" + +# get available gtk-themes +for DIR in "$GTK_DIRS"; do + INST_GTK=`find "$DIR" -maxdepth 1 -type d | sed -e "s#$DIR##"` +done + +# get available icon-themes +for DIR in "$ICON_DIRS"; do + INST_ICON=`find "$DIR" -maxdepth 1 -type d | sed -e "s#$DIR##"` +done + +# EOF set_theme.sh