The officially official Devuan Forum!

You are not logged in.

#1 2020-12-08 13:56:54

dice
Member
Registered: 2020-11-22
Posts: 128  
Website

yad tips and tricks.

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

2020-12-08-234940-1366x768-scrot.png 2020-12-08-235059-1366x768-scrot.png

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)


“That which is below is like that which is above, and that which is above is like that which is below, to perform the miracles of one only thing.”

-Hermes Trismegistos

Offline

#2 2020-12-08 16:59:46

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 1,282  
Website

Re: yad tips and tricks.

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)


Black Lives Matter

Offline

#3 2020-12-09 00:46:36

dice
Member
Registered: 2020-11-22
Posts: 128  
Website

Re: yad tips and tricks.

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.


“That which is below is like that which is above, and that which is above is like that which is below, to perform the miracles of one only thing.”

-Hermes Trismegistos

Offline

#4 2020-12-09 08:49:40

dice
Member
Registered: 2020-11-22
Posts: 128  
Website

Re: yad tips and tricks.

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)


“That which is below is like that which is above, and that which is above is like that which is below, to perform the miracles of one only thing.”

-Hermes Trismegistos

Offline

Board footer