From e5532752993f463524e0c89d5e82b5a84a77759b Mon Sep 17 00:00:00 2001 From: Yaroslav Date: Mon, 3 Feb 2020 00:01:16 +0300 Subject: load gtk settings on sway start, vpn shortcut and waybar indicator --- dotfiles/.local/bin/barrecstatus | 8 ++++++++ dotfiles/.local/bin/barvpnstatus | 9 +++++++++ dotfiles/.local/bin/barweather | 18 ++++++++++++++++++ dotfiles/.local/bin/i3barmusic | 18 ------------------ dotfiles/.local/bin/i3barrecstatus | 8 -------- dotfiles/.local/bin/i3barweather | 18 ------------------ dotfiles/.local/bin/swayrecord | 8 ++++---- dotfiles/.local/bin/swaystart | 12 ------------ dotfiles/.local/bin/togglevpn | 16 ++++++++++++++++ 9 files changed, 55 insertions(+), 60 deletions(-) create mode 100755 dotfiles/.local/bin/barrecstatus create mode 100755 dotfiles/.local/bin/barvpnstatus create mode 100755 dotfiles/.local/bin/barweather delete mode 100755 dotfiles/.local/bin/i3barmusic delete mode 100755 dotfiles/.local/bin/i3barrecstatus delete mode 100755 dotfiles/.local/bin/i3barweather delete mode 100755 dotfiles/.local/bin/swaystart create mode 100755 dotfiles/.local/bin/togglevpn (limited to 'dotfiles/.local') diff --git a/dotfiles/.local/bin/barrecstatus b/dotfiles/.local/bin/barrecstatus new file mode 100755 index 0000000..b7bb8b4 --- /dev/null +++ b/dotfiles/.local/bin/barrecstatus @@ -0,0 +1,8 @@ +#!/bin/sh + +if [ -f "$HOME/.cache/recordingpid" ]; then + printf "⏺ rec" + exit +fi + +printf "" diff --git a/dotfiles/.local/bin/barvpnstatus b/dotfiles/.local/bin/barvpnstatus new file mode 100755 index 0000000..1af57c4 --- /dev/null +++ b/dotfiles/.local/bin/barvpnstatus @@ -0,0 +1,9 @@ +#!/bin/sh + +if [ -f "$HOME/.cache/openvpnpid" ]; then + printf "🔐 vpn" + exit +fi + +printf "" + diff --git a/dotfiles/.local/bin/barweather b/dotfiles/.local/bin/barweather new file mode 100755 index 0000000..0ae6d3c --- /dev/null +++ b/dotfiles/.local/bin/barweather @@ -0,0 +1,18 @@ +#!/bin/bash + +location="Saint Petersburg" + +if [[ "$location" != "" ]] +then + location="~${location// /+}" +fi + +forecast=$(curl -s wttr.in/$location?format=1) + +if [[ ${#forecast} -gt 30 ]] +then + exit +fi + +echo $forecast + diff --git a/dotfiles/.local/bin/i3barmusic b/dotfiles/.local/bin/i3barmusic deleted file mode 100755 index 5647a81..0000000 --- a/dotfiles/.local/bin/i3barmusic +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -filter() { - sed "/^volume:/d" | tac | sed -e "s/\\&/&/g;s/\\[paused\\].*//g;s/\\[playing\\].*//g" | tr -d '\n' | sed -e "s/$/<\\/span>/g" - } - -case $BLOCK_BUTTON in - 1) mpc toggle | filter ;; - 2) mpc status | filter && setsid "$TERMINAL" -e ncmpcpp & ;; - 3) mpc status | filter && notify-send "🎵 Music module" "\- Shows mpd song playing. -- Italic when paused. -- Left click opens ncmpcpp. -- Middle click pauses. -- Scroll changes track.";; # right click, pause/unpause - 4) mpc prev | filter ;; # scroll up, previous - 5) mpc next | filter ;; # scroll down, next - *) mpc status | filter ;; -esac; exit diff --git a/dotfiles/.local/bin/i3barrecstatus b/dotfiles/.local/bin/i3barrecstatus deleted file mode 100755 index 5c8160a..0000000 --- a/dotfiles/.local/bin/i3barrecstatus +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -if [ -f "$HOME/.recordingpid" ]; then - printf "rec ⏺" - exit -fi - -printf "" diff --git a/dotfiles/.local/bin/i3barweather b/dotfiles/.local/bin/i3barweather deleted file mode 100755 index 0ae6d3c..0000000 --- a/dotfiles/.local/bin/i3barweather +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -location="Saint Petersburg" - -if [[ "$location" != "" ]] -then - location="~${location// /+}" -fi - -forecast=$(curl -s wttr.in/$location?format=1) - -if [[ ${#forecast} -gt 30 ]] -then - exit -fi - -echo $forecast - diff --git a/dotfiles/.local/bin/swayrecord b/dotfiles/.local/bin/swayrecord index 90ed24a..378b46f 100755 --- a/dotfiles/.local/bin/swayrecord +++ b/dotfiles/.local/bin/swayrecord @@ -1,14 +1,14 @@ #!/bin/sh -if [ -f "$HOME/.recordingpid" ]; then +if [ -f "$HOME/.cache/recordingpid" ]; then killall -SIGINT wf-recorder - rm -f ~/.recordingpid + rm -f ~/.cache/recordingpid notify-send "⏺ Screen recording" "Recording stopped" killall -39 waybar exit fi -wf-recorder -f "$HOME/Video/recordings/$(date '+%y%m%d-%H%M-%S').mp4" & -echo $! > ~/.recordingpid +wf-recorder -f "$HOME/Videos/recordings/$(date '+%y%m%d-%H%M-%S').mp4" & +echo $! > ~/.cache/recordingpid notify-send "⏺ Screen recording" "Recording started" killall -39 waybar diff --git a/dotfiles/.local/bin/swaystart b/dotfiles/.local/bin/swaystart deleted file mode 100755 index 46f6f0e..0000000 --- a/dotfiles/.local/bin/swaystart +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -export SCROT_DIR=$HOME/Pictures/screenshots/ -export GDK_BACKEND=wayland -export EGL_PLATFORM=wayland -export CLUTTER_PLATFORM=wayland -export SDL_VIDEODRIVER=wayland -export QT_QPA_PLATFORM=wayland-egl -export QT_WAYLAND_DISABLE_WINDOWDECORATION=1 -export QT_QPA_PLATFORMTHEME="qt5ct" -export _JAVA_AWT_WM_NONREPARENTING=1 -sway --my-next-gpu-wont-be-nvidia diff --git a/dotfiles/.local/bin/togglevpn b/dotfiles/.local/bin/togglevpn new file mode 100755 index 0000000..f1a6bdb --- /dev/null +++ b/dotfiles/.local/bin/togglevpn @@ -0,0 +1,16 @@ +#!/bin/sh + +if [ -f "$HOME/.cache/openvpnpid" ]; then + sudo killall -SIGINT openvpn + exit +fi + +sudo openvpn "$HOME/.config/ovpn/conf.ovpn" & +PID=$! +notify-send "🔐 OpenVPN" "VPN is being initialized" +echo $PID > ~/.cache/openvpnpid +killall -40 waybar +wait $PID +notify-send "🔐 OpenVPN" "VPN service has stopped with exit code $?" +rm ~/.cache/openvpnpid +killall -40 waybar -- cgit v1.2.3