File tree Expand file tree Collapse file tree 9 files changed +82
-63
lines changed
Expand file tree Collapse file tree 9 files changed +82
-63
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ # 前提:sudo命令无需输入密码
3+ # 功能:运行sudo cancel -a取消所有打印任务
4+ # 快捷键:Alt+Shift+P
5+ # 使用:gnome-terminal -- "Path to Cancel_All_Print_Task.sh"
6+
7+
8+ # 颜色colors
9+ CDEF=" \033[0m" # default color
10+ CCIN=" \033[0;36m" # info color
11+ CGSC=" \033[0;32m" # success color
12+ CRER=" \033[0;31m" # error color
13+ CWAR=" \033[0;33m" # warning color
14+ b_CDEF=" \033[1;37m" # bold default color
15+ b_CCIN=" \033[1;36m" # bold info color
16+ b_CGSC=" \033[1;32m" # bold success color
17+ b_CRER=" \033[1;31m" # bold error color
18+ b_CWAR=" \033[1;33m"
19+
20+ # echo like ... with flag type and display message colors
21+ # -s 绿
22+ # -e 红
23+ # -w 黄
24+ # -i 蓝
25+ prompt () {
26+ case ${1} in
27+ " -s" |" --success" )
28+ echo -e " ${b_CGSC}${@/ -s/ }${CDEF} " ;; # print success message
29+ " -e" |" --error" )
30+ echo -e " ${b_CRER}${@/ -e/ }${CDEF} " ;; # print error message
31+ " -w" |" --warning" )
32+ echo -e " ${b_CWAR}${@/ -w/ }${CDEF} " ;; # print warning message
33+ " -i" |" --info" )
34+ echo -e " ${b_CCIN}${@/ -i/ }${CDEF} " ;; # print info message
35+ * )
36+ echo -e " $@ "
37+ ;;
38+ esac
39+ }
40+
41+ print_comfirm () {
42+ flag=true
43+ while $flag
44+ do
45+ echo -en " \033[1;31m WARN: ALL PRINT TASK WILL BE CANCELED ! \033[1;33m"
46+ if read -t 5 -p " Sure to send to printer ? (Y/n) " input
47+ then
48+ if [ -z " ${input} " ]; then
49+ input=' y'
50+ fi
51+ else
52+ prompt -e " \n\nERROR: Timeout, quit[1]. Canceled and released !"
53+ exit 1
54+ fi
55+ case $input in [yY][eE][sS]|[yY])
56+ sudo cancel -a
57+ prompt -i " All jobs have been released! "
58+ sleep 2
59+ flag=false
60+ ;;
61+ [nN][oO]|[nN])
62+ exit 0
63+ flag=false
64+ ;;
65+ * )
66+ prompt -w " Invalid input..."
67+ ;;
68+ esac
69+ done
70+ }
71+
72+
73+ print_comfirm
74+
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ sleep 8
3+ gnome-screensaver-command -l
Original file line number Diff line number Diff line change 448448- 2021年9月26日——0.0.1
449449 - 从Debian 10迁移到Debian 11
450450
451+ # 其他脚本——OtherScripts
452+
453+ - Cancel_All_Print_Task.sh——取消所有打印任务
454+ - GNOME_Lock_Screen.sh——GNOME锁屏
455+
451456# Debian10_GNOME.sh(2021年7月停止维护)
452457
453458>Last Version: v3.3.7
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments