-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathzen_task_menu
executable file
·79 lines (71 loc) · 3.18 KB
/
zen_task_menu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
# Zen_task_menu
# mon. sept. 4 2023
# Copyleft 2023 PirateProd
# <wildtruc@noneltd.net>
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with main.c;if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA
d_yad=$(command -v yad)
d_zen=$(command -v zenvidia)
local_conf_dir=/home/$USER/.zenvidia
local_notif=$local_conf_dir/taskbar_message
icon_stock=/usr/local/share/pixmaps
img_zen=$icon_stock/zen-emblem.png
img_zen_green=$icon_stock/zen-emblem-gr.png
img_nv_settings=$icon_stock/zen-settings.png
img_zen_desktop=$img_zen
version=$(cat $local_conf_dir/version.txt)
# define active user for pid file creation and check.
# def_user_id=$(loginctl list-users --no-legend | grep "active"|awk '{print $1}')
# menu_pid=/run/user/${def_user_id}/zen_task.pid
# test -f ${menu_pid} && test $(ps -A --no-headers| grep -c $(cat $menu_pid)) -gt 0 && exit 0
test -f $local_conf_dir/basic.conf && . $local_conf_dir/basic.conf || exit 0
export PATH=$PATH:/usr/local/bin
export TEXTDOMAIN=zenvidia
export TEXTDOMAINDIR=/usr/local/share/zenvidia/locale
[ $open_drv = 1 ] && open_menu=$"Open Driver Switch"'!zen_start -o!zen-swap,'
[ $use_open = 1 ] && adds='open-source' || adds='close-source'
[ $(xrandr --listproviders|grep -wc "Provider" ) -gt 1 ] && \
[ $(xrandr --listproviders|grep -c "NVIDIA" ) = 1 ] && opti_menu=$"PRIME Display configuration"'!zen_start -p!zen-prime,'
if [ -f $local_conf_dir/version.txt ]; then
driver_changelog=$" Read ${version} change log"'!'${d_zen}' -d!zen-info,'
nvidia_help=$" Nvidia ${version} documentation"'!'${d_zen}' -h!zen-question,'
[ "$version" != '' ] && version_txt=$"<b>$version</b> in use. <small>($adds)</small>" || version_txt=$"no driver detected"
fi
if [ -f $local_notif ]; then
. $local_notif
if [ $notif = 1 ]; then
embed_text="$(cat <<-MSG
$version_txt
$notif_text
MSG
)"
else
embed_text="$version_txt"
fi
changelog_menu=$" Read Zenvidia change log"'!'${d_zen}' -r!zen-warning,'
fi
menu_list=(
\ $"Start zenvidia"!zen_start!$img_zen,
$"Nvidia Settings (user)"!nvidia-settings!$img_nv_settings,
$"Config xorg"!zen_start -x!zen-xorg,${opti_menu}
$"Edit Zenvidia configuration"!$d_zen -z!zen-preference,
$"Check Nvidia driver Update"!zen_start -u!zen-refresh,
${open_menu}${driver_changelog}${nvidia_help}${changelog_menu}
$"Zenvidia Help and documentation"!$d_zen -s!zen-docs,
#$"Zenvidia About"!$d_zen -a!zen-docs,
$"Close Zenvidia task menu"!quit!zen-stop
)
$d_yad --notification --image=$img_zen_desktop --no-middle --command='' --text="$embed_text" \
--icon-size=24 --menu="${menu_list[*]}" --separator=',' & # echo $(pgrep -n yad) > $menu_pid