diff options
| author | Karel Kočí <cynerd@email.cz> | 2022-06-10 14:14:22 +0200 | 
|---|---|---|
| committer | Karel Kočí <cynerd@email.cz> | 2022-06-10 14:14:22 +0200 | 
| commit | c5510367db582d1c0683f182dd0e151ea0ab3b5f (patch) | |
| tree | e43d7d6a4eae8d586ac8b43ef436ae178465bcfe /local/bin | |
| parent | 3c905d717a331b9be6d7036624378d0617234a82 (diff) | |
| download | myconfigs-c5510367db582d1c0683f182dd0e151ea0ab3b5f.tar.gz myconfigs-c5510367db582d1c0683f182dd0e151ea0ab3b5f.tar.bz2 myconfigs-c5510367db582d1c0683f182dd0e151ea0ab3b5f.zip  | |
Improvements for NixOS
Diffstat (limited to 'local/bin')
| -rwxr-xr-x | local/bin/allsync | 32 | ||||
| -rwxr-xr-x | local/bin/sshvnc | 2 | ||||
| -rwxr-xr-x | local/bin/startsway | 9 | 
3 files changed, 32 insertions, 11 deletions
diff --git a/local/bin/allsync b/local/bin/allsync index c268b97..e5bb633 100755 --- a/local/bin/allsync +++ b/local/bin/allsync @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash  set -eu  cronline="* * * * * /bin/sh -c 'AUTORUN=y /home/cynerd/.local/bin/allsync'" @@ -16,20 +16,32 @@ i3_astroid() {  cron_enable() {  	pass mail/cynerd@email.cz >/dev/null # Cache keys -	{ -		crontab -l  -		echo "$cronline" -	} | crontab - +	if command -v crontab >/dev/null; then +		{ +			crontab -l  +			echo "$cronline" +		} | crontab - +	else +		systemctl --user start allsync.timer +	fi  	notify_i3block  }  cron_disable() { -	crontab -l | grep -Fv "$cronline" | crontab - +	if command -v crontab >/dev/null; then +		crontab -l | grep -Fv "$cronline" | crontab - +	else +		systemctl --user stop allsync.timer +	fi  	notify_i3block  }  cron_enabled() { -	crontab -l | grep -Fq "$cronline" +	if command -v crontab >/dev/null; then +		crontab -l | grep -Fq "$cronline" +	else +		systemctl --user is-active allsync.timer >/dev/null +	fi  }  if [ "$#" -gt 0 ]; then @@ -67,6 +79,7 @@ fi  ################################################################################## +flock_nonblock=""  if [ "${AUTORUN:-n}" = "y" ]; then  	exec &> >(logger -t "${0##*/}") @@ -75,10 +88,13 @@ if [ "${AUTORUN:-n}" = "y" ]; then  		cron_disable  		exit 1  	fi +	flock_nonblock="--nonblock"  fi  if [ "${ALLSYNC_FLOCK:-n}" != "y" ]; then -	ALLSYNC_FLOCK=y exec flock --exclusive "$HOME/.mail" "$0" "$@" +	ALLSYNC_FLOCK=y exec flock $flock_nonblock --exclusive "$HOME/.mail" "$0" "$@" +	echo "Another instance is alredy running" >&2 +	exit 1  fi diff --git a/local/bin/sshvnc b/local/bin/sshvnc index af133b4..fcee459 100755 --- a/local/bin/sshvnc +++ b/local/bin/sshvnc @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash  set -eu  target="$1" diff --git a/local/bin/startsway b/local/bin/startsway index 63163ee..1639277 100755 --- a/local/bin/startsway +++ b/local/bin/startsway @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash  set -eu  exec 1> >(logger -s -t "${0##*/}") 2>&1 @@ -17,4 +17,9 @@ export MOZ_ENABLE_WAYLAND=1  # Java application do not display properly  export _JAVA_AWT_WM_NONREPARENTING=1 -exec dbus-run-session sway +dbus="dbus-run-session" +if command -v systemctl >/dev/null; then +	dbus="" +fi + +exec $dbus sway  | 
