Improve waybar and custom scripts
This commit is contained in:
7
modules/optionnals/desktop/config/etc/xdg/scripts/rofi-ssh.sh
Executable file
7
modules/optionnals/desktop/config/etc/xdg/scripts/rofi-ssh.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
selected=$(cat ~/.config/zsh/.zsh_history | sed 's/^[ ]*[0-9]*[ ]*//' | grep '^ssh ' | rofi -dmenu -i -theme /etc/xdg/rofi/ssh.rasi -p SSH)
|
||||
|
||||
if [[ -n "$selected" ]]; then
|
||||
kitty -e $selected
|
||||
fi
|
||||
26
modules/optionnals/desktop/config/etc/xdg/scripts/waybar-mailbox.sh
Executable file
26
modules/optionnals/desktop/config/etc/xdg/scripts/waybar-mailbox.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
_USER=beastie
|
||||
_PASSWD='}q6658JD~{}{oiRWsb~Q{P@SV=Qsy,ae'
|
||||
_SERVER=unixyourbrain.org
|
||||
_FOLDER=Admin
|
||||
|
||||
set -e
|
||||
|
||||
cd -- "$(dirname -- "$0")"
|
||||
_DIRNAME="$(pwd)"
|
||||
|
||||
### Sourcer à partir des secrets
|
||||
#source ~/.config/polybar/imap_creds
|
||||
|
||||
|
||||
_COUNT=$(curl -u "$_USER:$_PASSWD" "imaps://$_SERVER" -X "STATUS $_FOLDER (UNSEEN)" 2>/dev/null | \
|
||||
sed -e 's/)\r//' -e 's/.*UNSEEN //')
|
||||
|
||||
_UNSEEN=$(curl -u "$_USER:$_PASSWD" "imaps://$_SERVER/$_FOLDER" -X "SEARCH UNSEEN" 2>/dev/null | \
|
||||
sed -e "s|\\r||" -e "s|* SEARCH ||" -e "s| |,|g")
|
||||
|
||||
_MAILS=$(curl -v -u "$_USER:$_PASSWD" "imaps://$_SERVER/$_FOLDER" -X "FETCH $_UNSEEN BODY.PEEK[HEADER.FIELDS (From Subject)]" 2>&1 | \
|
||||
sed -e "s|\\r||" | awk '/< Subject|< From/ {sub(/^< /, ""); printf "%s\\n", $0}')
|
||||
|
||||
printf '{"text": "%s ", "tooltip": "%s"}' "$_COUNT" "$_MAILS"
|
||||
31
modules/optionnals/desktop/config/etc/xdg/scripts/wayland-disconnect.sh
Executable file
31
modules/optionnals/desktop/config/etc/xdg/scripts/wayland-disconnect.sh
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
selected=$(printf "Lock\0icon\x1fsystem-lock-screen
|
||||
Update\0icon\x1fsystem-software-update
|
||||
Shutdown\0icon\x1fsystem-shutdown
|
||||
Reboot\0icon\x1fsystem-reboot
|
||||
Exit hyprland\0icon\x1fsystem-log-out
|
||||
Reload hyprland\0icon\x1fsystem-log-out" | rofi -dmenu -show-icons -i -theme /etc/xdg/rofi/disconnect.rasi -p System)
|
||||
|
||||
echo "$selected"
|
||||
|
||||
case $selected in
|
||||
"Lock")
|
||||
/nix/store/4pwvyyjrc7frwkycbszakd7z6nf44qgv-hyprlock-0.9.2/bin/hyprlock
|
||||
;;
|
||||
"Update")
|
||||
kitty /usr/local/share/dotfiles/scripts/update.sh
|
||||
;;
|
||||
"Shutdown")
|
||||
systemctl poweroff
|
||||
;;
|
||||
"Reboot")
|
||||
reboot
|
||||
;;
|
||||
"Exit hyprland")
|
||||
hyprctl dispatch exit
|
||||
;;
|
||||
"Reload hyprland")
|
||||
hyprctl reload
|
||||
;;
|
||||
esac
|
||||
31
modules/optionnals/desktop/config/etc/xdg/scripts/wayland-mpv.sh
Executable file
31
modules/optionnals/desktop/config/etc/xdg/scripts/wayland-mpv.sh
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
cd -- "$(dirname -- "$0")" || exit
|
||||
|
||||
## if not $1
|
||||
if [[ -z $1 ]]
|
||||
then
|
||||
_LINES=$(curl "http://10.0.0.1:2013" 2>/dev/null | sed -e "s|.*<a href=\"\([^\"]*\).*|$1\1|" -e "s/.*<.*\|.*C=D.*\|.*\/\/$\|.*.nfo//" -e "/^$/d")
|
||||
else
|
||||
_LINES="$(curl "http://10.0.0.1:2013/$1" 2>/dev/null | sed -e "s|.*<a href=\"\([^\"]*\).*|$1\1|" -e "s/.*<.*\|.*C=D.*\|.*\/\/$\|.*.nfo//" -e "/^$/d")"
|
||||
fi
|
||||
|
||||
_RESULT=$(rofi -dmenu -i -theme /etc/xdg/rofi/mpv.rasi -p Mpv <<< "$_LINES")
|
||||
|
||||
# If no output
|
||||
echo "$_RESULT"
|
||||
if [[ -z $_RESULT ]]
|
||||
then
|
||||
echo "no output, exiting"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#if line end vith /
|
||||
if [[ "$_RESULT" =~ .*/$ ]]
|
||||
then
|
||||
echo "output is a directory"
|
||||
./wayland-mpv.sh "$_RESULT"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
mpv "http://10.0.0.1:2013/$_RESULT"
|
||||
Reference in New Issue
Block a user