aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/.local/bin
diff options
context:
space:
mode:
authorYaroslav de la Peña Smirnov <yps@yaroslavps.com>2022-05-17 06:10:02 +0300
committerYaroslav de la Peña Smirnov <yps@yaroslavps.com>2022-05-17 06:10:02 +0300
commit484181c25cba61469254e24bff578cff5189c8a7 (patch)
tree6bb3b33b3c710467a6f0463912b929f2e039cd90 /dotfiles/.local/bin
parent0b065dc2c0cae46c4f6151483249a682db122eb6 (diff)
downloadswayrice-484181c25cba61469254e24bff578cff5189c8a7.tar.gz
swayrice-484181c25cba61469254e24bff578cff5189c8a7.zip
WIP: move to rofi
Diffstat (limited to 'dotfiles/.local/bin')
-rwxr-xr-xdotfiles/.local/bin/rofidisplay13
-rwxr-xr-xdotfiles/.local/bin/rofimoji12
-rwxr-xr-xdotfiles/.local/bin/rofisession15
-rwxr-xr-xdotfiles/.local/bin/rofiwebsurf23
-rwxr-xr-xdotfiles/.local/bin/swaysession11
5 files changed, 69 insertions, 5 deletions
diff --git a/dotfiles/.local/bin/rofidisplay b/dotfiles/.local/bin/rofidisplay
new file mode 100755
index 0000000..26f0f1a
--- /dev/null
+++ b/dotfiles/.local/bin/rofidisplay
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+if [ "$ROFI_RETV" != 0 ]; then
+ swaymsg output $1 toggle > /dev/null
+fi
+
+displays="$(swaymsg -t get_outputs | grep -E "name" |
+ sed "s/^.*\"name\": \"//g;s/\",$//g;")"
+
+echo -ne "\0prompt\x1fToggle display\n"
+for d in $displays; do
+ echo -ne "$d\0icon\x1fdisplay\n"
+done
diff --git a/dotfiles/.local/bin/rofimoji b/dotfiles/.local/bin/rofimoji
new file mode 100755
index 0000000..64cfabe
--- /dev/null
+++ b/dotfiles/.local/bin/rofimoji
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+list="$(grep -v "#" ~/.local/share/script-data/emoji)"
+if [ "$ROFI_RETV" != 0 ]; then
+ c=$(echo "$1" | cut -f1)
+ echo "$c" | tr -d '\n' | wl-copy
+ notify-send "'$c' copied to clipboard."
+ exit
+fi
+
+echo -ne "\0prompt\x1fChoose emoji\n"
+printf "%s" "$list"
diff --git a/dotfiles/.local/bin/rofisession b/dotfiles/.local/bin/rofisession
new file mode 100755
index 0000000..88cf3c6
--- /dev/null
+++ b/dotfiles/.local/bin/rofisession
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+export SWAYSESSION_GUI=1
+
+if [ -n "$1" ]; then
+ swaysession $1 > /dev/null
+ exit 0
+fi
+
+echo -ne "\0no-custom\x1ftrue\n"
+echo -ne "\0prompt\x1fWhat to do?\n"
+echo -ne "logout\0icon\x1fsystem-log-out\n"
+echo -ne "suspend\0icon\x1fsystem-suspend\n"
+echo -ne "reboot\0icon\x1fsystem-restart\n"
+echo -ne "poweroff\0icon\x1fsystem-shutdown\n"
diff --git a/dotfiles/.local/bin/rofiwebsurf b/dotfiles/.local/bin/rofiwebsurf
new file mode 100755
index 0000000..b6f6e87
--- /dev/null
+++ b/dotfiles/.local/bin/rofiwebsurf
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+if [ "$ROFI_RETV" != 0 ]; then
+ choice="$1"
+ if echo "$choice" | egrep ".*://.*" >/dev/null 2>&1; then
+ choice="$(echo "$choice" | sed -E 's/(.*:\/\/([^[:space:]])*).*/\1/g' |
+ grep -E "https?:" || echo "$choice")"
+ mimeo "$choice" > /dev/null
+ else
+ setsid $BROWSER "$choice" > /dev/null &
+ fi
+ exit 0
+fi
+
+qmarks="$HOME/.config/qutebrowser/quickmarks"
+bmarks="$HOME/.config/qutebrowser/bookmarks/urls"
+hist="$HOME/.local/share/qutebrowser/history.sqlite"
+prompt="$(sqlite3 -separator ' ' "$hist" \
+ 'select title, url from CompletionHistory' |
+ cat "$qmarks" - | cat "$bmarks" -)"
+
+echo -ne "\0prompt\x1fEnter query or link\n"
+printf "%s" "$prompt"
diff --git a/dotfiles/.local/bin/swaysession b/dotfiles/.local/bin/swaysession
index c4fa4db..2234c11 100755
--- a/dotfiles/.local/bin/swaysession
+++ b/dotfiles/.local/bin/swaysession
@@ -1,8 +1,6 @@
#!/bin/sh
-# /usr/bin/i3exit
-# on void just sudo
-[[ $(cat /proc/1/comm) == "systemd" ]] && logind=systemctl || logind=loginctl
+[ "$(cat /proc/1/comm)" = "systemd" ] && logind=systemctl || logind=loginctl
case "$1" in
lock)
@@ -29,8 +27,11 @@ case "$1" in
$logind poweroff
;;
*)
- echo "== ! i3exit: missing or invalid argument ! =="
- echo "Try again with: lock | logout | switch_user | suspend | hibernate | reboot | shutdown"
+ if [ "$SWAYSESSION_GUI" = 1 ]; then
+ notify-send "🖥 swaysession" "Invalid option"
+ else
+ echo "swaysession: missing or invalid argument"
+ fi
exit 2
esac