diff --git a/snippets.sh b/snippets.sh deleted file mode 100755 index 8bdf2ea..0000000 --- a/snippets.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash -# Copy snippet to primary clipboard for middle-click pasting - -# Maintain list of snippets in private repository -FOLDER=${HOME}/.private-scripts/snippets - -FILE=`ls ${FOLDER} | /usr/bin/rofi -dmenu` - -if [ -f ${FOLDER}/${FILE} ]; then - DATA=$([ -x "${FOLDER}/${FILE}" ] && bash "${FOLDER}/${FILE}" || head --bytes=-1 ${FOLDER}/${FILE}) - printf -- "${DATA}" | wl-copy -p -fi diff --git a/tofi/power/↩ Logout b/tofi/power/↩ Logout new file mode 100755 index 0000000..22ef09c --- /dev/null +++ b/tofi/power/↩ Logout @@ -0,0 +1,6 @@ +#!/bin/bash +if [ -z ${SWAYSOCK+x} ]; then + i3lock -c 000000 +else + swaylock -c 000000 +fi diff --git a/tofi/power/↯ Hibernate b/tofi/power/↯ Hibernate new file mode 100755 index 0000000..dd50c59 --- /dev/null +++ b/tofi/power/↯ Hibernate @@ -0,0 +1,2 @@ +#!/bin/bash +systemctl hibernate -i diff --git a/tofi/power/↻ Reload Desktop b/tofi/power/↻ Reload Desktop new file mode 100755 index 0000000..70cdeb6 --- /dev/null +++ b/tofi/power/↻ Reload Desktop @@ -0,0 +1,7 @@ +#!/bin/bash +if [ -z ${SWAYSOCK+x} ]; then + i3 reload +else + swaymsg reload + distrobox-enter -n debian${HOME}/scripts/sway/displays.pl +fi diff --git a/tofi/power/↻ Reload Toolbar b/tofi/power/↻ Reload Toolbar new file mode 100755 index 0000000..fded253 --- /dev/null +++ b/tofi/power/↻ Reload Toolbar @@ -0,0 +1,6 @@ +#!/bin/bash +if [ -z ${SWAYSOCK+x} ]; then + i3 reload +else + ${HOME}/scripts/sway/displays.pl -w +fi diff --git a/tofi/power/⏻ Shutdown b/tofi/power/⏻ Shutdown new file mode 100755 index 0000000..e69fc47 --- /dev/null +++ b/tofi/power/⏻ Shutdown @@ -0,0 +1,3 @@ +#!/bin/bash +rm /var/home/jpm/.spool/ssh-agent.sock +systemctl poweroff -i diff --git a/tofi/power/⚿ Lock b/tofi/power/⚿ Lock new file mode 100755 index 0000000..22ef09c --- /dev/null +++ b/tofi/power/⚿ Lock @@ -0,0 +1,6 @@ +#!/bin/bash +if [ -z ${SWAYSOCK+x} ]; then + i3lock -c 000000 +else + swaylock -c 000000 +fi diff --git a/tofi/power/⚿ Restart Yubico Authenticator b/tofi/power/⚿ Restart Yubico Authenticator new file mode 100755 index 0000000..8c40c13 --- /dev/null +++ b/tofi/power/⚿ Restart Yubico Authenticator @@ -0,0 +1,13 @@ +#!/bin/bash +RUNNING=$(pgrep yubioath-deskto) +if [ "$RUNNING" ]; then + kill $RUNNING + sudo systemctl stop pcscd.socket + sudo systemctl restart pcscd.service + sudo systemctl start pcscd.socket +fi +if [ -z ${SWAYSOCK+x} ]; then + QT_QPA_PLATFORMTHEME=qt5ct QT_QPA_PLATFORM=wayland QT_PLUGIN_PATH=/usr/lib/qt/plugins flatpak run com.yubico.yubioath & +else + QT_QPA_PLATFORMTHEME=qt5ct QT_QPA_PLATFORM=wayland QT_PLUGIN_PATH=/usr/lib/qt/plugins flatpak run com.yubico.yubioath & +fi diff --git a/tofi/power/🖵 Toggle Displays b/tofi/power/🖵 Toggle Displays new file mode 100755 index 0000000..55ea181 --- /dev/null +++ b/tofi/power/🖵 Toggle Displays @@ -0,0 +1,7 @@ +#!/bin/bash +if [ -z ${SWAYSOCK+x} ]; then + # xrandr command here + :: +else + distrobox-enter -n debian -- ${HOME}/scripts/sway/toggle_outputs.sh +fi diff --git a/tofi/power/🡙 Reboot b/tofi/power/🡙 Reboot new file mode 100755 index 0000000..e2fd573 --- /dev/null +++ b/tofi/power/🡙 Reboot @@ -0,0 +1,3 @@ +#!/bin/bash +rm /var/home/jpm/.spool/ssh-agent.sock +systemctl reboot -i diff --git a/tofi/tofi-menu.sh b/tofi/tofi-menu.sh new file mode 100755 index 0000000..85443d4 --- /dev/null +++ b/tofi/tofi-menu.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +cd ${HOME}/scripts/tofi +if [ -z $1 ]; then + echo -n "Argument required. Available arguments are:" + for i in $(find -type d); do + i=$(echo $i | sed -E 's/^\.\/?//') + echo " $i" + done + cd ${HOME}/.private-scripts/tofi + $(find -type d) + for i in $(find -type d); do + i=$(echo $i | sed -E 's/^\.\/?//') + echo " $i" + done + exit +fi +if [ ! -e $1 ]; then + cd ${HOME}/.private-scripts/tofi + if [ ! -e $1 ]; then + echo "$PWD/$1 is not a tofi directory" + exit + fi +fi +cd $1 + +HEIGHT=$(swaymsg -t get_outputs | tr '\n' ' ' | sed -e 's/ */ /g' | sed -e 's/\(.*"focused": [a-z]*\),/\1\n/' | less | grep '"focused": true' | sed -e 's/.*"rect": {[^}]*"height": \([0-9]*\).*/\1/') + +exec "./$(find ./ -executable -type f | sed -E 's/\.\///' | tofi --prompt-text 'Power: ' --height $HEIGHT --config ${HOME}/.dotfiles/tofi/sidebar.toml)" 2>/dev/null diff --git a/tofi/tofi-snippets.sh b/tofi/tofi-snippets.sh new file mode 100755 index 0000000..4f432b5 --- /dev/null +++ b/tofi/tofi-snippets.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +# Copy snippet to primary clipboard for middle-click pasting + +# Maintain list of snippets in private repository +cd ${HOME}/.private-scripts/snippets + +HEIGHT=$(swaymsg -t get_outputs | tr '\n' ' ' | sed -e 's/ */ /g' | sed -e 's/\(.*"focused": [a-z]*\),/\1\n/' | less | grep '"focused": true' | sed -e 's/.*"rect": {[^}]*"height": \([0-9]*\).*/\1/') + +cat $(find ./ -type f | sed -E 's/\.\///' | tofi --prompt-text 'Snippets: ' --height $HEIGHT --config ${HOME}/.dotfiles/tofi/sidebar.toml) | wl-copy -p