File-based tofi menus
Also changed the snippet script to use this method
This commit is contained in:
parent
e5b3acb5e4
commit
d4e274c29a
12
snippets.sh
12
snippets.sh
|
@ -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
|
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash
|
||||
if [ -z ${SWAYSOCK+x} ]; then
|
||||
i3lock -c 000000
|
||||
else
|
||||
swaylock -c 000000
|
||||
fi
|
|
@ -0,0 +1,2 @@
|
|||
#!/bin/bash
|
||||
systemctl hibernate -i
|
|
@ -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
|
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash
|
||||
if [ -z ${SWAYSOCK+x} ]; then
|
||||
i3 reload
|
||||
else
|
||||
${HOME}/scripts/sway/displays.pl -w
|
||||
fi
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
rm /var/home/jpm/.spool/ssh-agent.sock
|
||||
systemctl poweroff -i
|
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash
|
||||
if [ -z ${SWAYSOCK+x} ]; then
|
||||
i3lock -c 000000
|
||||
else
|
||||
swaylock -c 000000
|
||||
fi
|
|
@ -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
|
|
@ -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
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
rm /var/home/jpm/.spool/ssh-agent.sock
|
||||
systemctl reboot -i
|
|
@ -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
|
|
@ -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
|
Loading…
Reference in New Issue