You are not logged in.
Pages: 1
Having discovered the wonderful yad program awhile back i have revisited it and give you the following cool scripts. The calendar is mainly a good script to use for the dwm statusbar with the systray patch.
Yad exit menu with papirus icons, this needs elogind to work, you could swap out the commands with sudo though.
Xscreensaver for locking, all other locking programs dont quite compare to it.
#!/usr/bin/env bash
yad-cancel() {
kill -USR1 $YAD_PID
}
export -f yad-cancel
yad --no-buttons --close-on-unfocus --width 200 --height 50 --form --columns 5 --borders=20 --center --on-top \
--field=Lock!"$HOME/bin/exit-icons/lock.svg":fbtn "xscreensaver-command -l" \
--field=Logout!"$HOME/bin/exit-icons/logout.svg":fbtn "pkill -U $USER" \
--field=Reboot!"$HOME/bin/exit-icons/reboot.svg":fbtn "loginctl reboot" \
--field=Poweroff!"$HOME/bin/exit-icons/poweroff.svg":fbtn "loginctl poweroff" \
--field=Cancel!"$HOME/bin/exit-icons/close.svg":fbtn "bash -c yad-cancel"
Yad notification calendar using gsimplecal.
#!/usr/bin/env bash
yad --notification \
--image="/usr/share/icons/Papirus-Dark/24x24/apps/office-calendar.svg" \
--command="gsimplecal" --text="$(date)" \
Some scrots
EDIT: calendar tooltip --text="$(date)" needs a 60 second loop, not sure how to implement that alongside yad?
UPDATE 12/12/20 : for yad exit menu using a newer version of yad (on artixlinux), i can call the icons from /usr/share/icons/Papirus as per below.
#!/bin/bash
yad-cancel() {
kill -USR1 $YAD_PID
}
export -f yad-cancel
yad --no-buttons --close-on-unfocus --width 500 --height 50 --form --columns=5 --borders=10 --center --on-top \
--field='!database-lock!lock':fbtn "xscreensaver-command -l" \
--field='!application-exit!logout':fbtn "loginctl kill-user $USER" \
--field='!reload!reboot':fbtn "loginctl reboot" \
--field='!system-shutdown-panel!poweroff':fbtn "loginctl poweroff" \
--field='!button_cancel!cancel':fbtn "bash -c yad-cancel"
Last edited by dice (2020-12-12 10:16:34)
Offline
Nice, thanks for sharing.
Apologies if this is an irritating point to raise but your scripts do not use bashisms so they could (should?) have a /bin/sh shebang instead.
EDIT: and did you know that yad already has a calendar?
yad --calendar
Last edited by Head_on_a_Stick (2020-12-08 17:04:00)
To obtain a root shell use su -. Using just su will result in "command not found" messages.
Offline
Im very novice at scripts, i had thought that they could just be /bin/sh, thanks.
Ahh yes i forgot yad had a calendar function, i will have to incorporate that instead maybe, although does gsimplecal have a bit more functionality than yad calendar? i will have to find out.
Offline
as promised, the yad exit icons. They are just recolored #15539E papirus 24x24 action and panel icons done in inkscape, all credit to papirus icons.
https://notabug.org/dice_1/dotfiles/src … with-icons
no longer available, deleted repo. The idea was no good anyway, i cant figure out how to save svg file properly.
Last edited by dice (2020-12-12 10:11:49)
Offline
here is something i picked up today in regards to having a tray menu app to logout and shutdown, the first script calls the exit.sh menu similar to how gnome-desktop does it but with dwm statusbar systray and you can easily lock and logout the session here, then when the shutdown is pressed the exit menu appears with reboot or shutdown. The tray icon needs to be specified directly within yad. This is for dwm using the systray patch as shown in screens but could be used for any panel with tray app i think.
#!/bin/sh
PIPE="/tmp/.pipe.tmp"
rm "$PIPE"
mkfifo "$PIPE"
exec 3<> "$PIPE"
yad --notification --listen <&3 &
echo "menu:\
Lock !i3lock-fancy!system-lock-screen-symbolic||\
Logout !loginctl kill-user "$USER"!exit||\
Shutdown !exit.sh!system-shutdown-symbolic" >&3
echo "icon:$HOME/.icons/system-shutdown-symbolic.svg" >&3
echo "tooltip:Right click to choose option" >&3
exit.sh script
#!/bin/bash
yad_cancel () {
kill -USR1 "$YAD_PID"
}
export -f yad_cancel
yad --no-buttons --geometry=150x100+1300+0 --form --columns=1 --borders=10 --keep-icon-size --on-top \
--field='!/usr/share/icons/Papirus-Dark/24x24/panel/system-restart-panel.svg!reboot':fbtn "loginctl reboot" \
--field='!/usr/share/icons/Papirus-Dark/24x24/panel/system-shutdown-panel.svg!poweroff':fbtn "loginctl poweroff" \
--field='!/usr/share/icons/Papirus-Dark/24x24/actions/button_cancel.svg!cancel':fbtn "bash -c 'yad_cancel'"
screens
Last edited by dice (2021-02-25 14:54:48)
Offline
messing about in yad again with my openbox/tint2 setup.
Here is a nice script you could use as a Places dialog button in tint2. I use spacefm as file manager, you could use pcmanfm etc etc.
What this does is bring up small yad dialog you can choose to open your file manager and cd into various directories.
#!/bin/sh
dialog=$(yad --window-icon=gtk-directory --mouse --timeout=3 --title "Select Directory" --form --field=Choose:DIR)
path=$(echo $dialog | awk 'BEGIN {FS="|" } { print $1 }')
spacefm "$path"
Last edited by dice (2021-07-08 07:22:02)
Offline
this one uses yad, imagemagick and xwallpaper to quickly create an plain-colored wallpaper
#!/bin/sh
FILE="$HOME/.local/wallpaper.png"
# use yad to select color value
COLOR="$(yad --title="Set Wallpaper" --color)"
# use imagemagick to create the png file
if [ "$COLOR" ]; then
[ -e "$FILE" ] && rm "$FILE"
convert -size $(xdpyinfo | awk '/dimensions/ {print $2}') canvas:$COLOR "$FILE"
# use xwallpaper to set the wallpaper
xwallpaper --zoom "$FILE"
fi
exit 0
Offline
I had not paid very much attention to yad, thanks to this thread cames to help me having a better gui for logout, reboot and poweroff.
I used dialog for those stuff, but yad to a better rescue.
Last edited by Nili (2022-04-16 18:47:19)
Devuan // CWM (lean & mean)
Offline
Pages: 1