zenity

利用 Shell 脚本让网站更具可读性

被刻印的时光 ゝ 提交于 2021-01-28 07:11:46
测算网站的文本和背景之间的对比度,以确保站点易于阅读。 如果希望人们发现你的网站实用,那么他们需要能够阅读它。为文本选择的颜色可能会影响网站的可读性。不幸的是,网页设计中的一种流行趋势是在打印输出文本时使用低对比度的颜色,就像在白色背景上的灰色文本。对于 Web 设计师来说,这也许看起来很酷,但对于许多阅读它的人来说确实很困难。 W3C 提供了《Web 内容可访问性指南Web Content Accessibility Guidelines》,其中包括帮助 Web 设计人员选择易于区分文本和背景色的指导。z这就是所谓的“对比度contrast ratio”。 W3C 定义的对比度需要进行一些计算:给定两种颜色,首先计算每种颜色的相对亮度,然后计算对比度。对比度在 1 到 21 的范围内(通常写为 1:1 到 21:1)。对比度越高,文本在背景下的突出程度就越高。例如,白色背景上的黑色文本非常醒目,对比度为 21:1。对比度为 1:1 的白色背景上的白色文本不可读。 W3C 说,正文 的对比度至少应为 4.5:1,标题至少应为 3:1。但这似乎是最低限度的要求。W3C 还建议正文至少 7:1,标题至少 4.5:1。 计算对比度可能比较麻烦,因此最好将其自动化。我已经用这个方便的 Bash 脚本做到了这一点。通常,脚本执行以下操作: 获取文本颜色和背景颜色 计算相对亮度 计算对比度

zenity --auto-kill: Killing a subshell does not kill its child processes?

北城余情 提交于 2020-06-29 13:19:25
问题 I am having a really hard time understanding the behaviour of zenity --progress --auto-kill . It appears to not kill its parent process' subprocesses but to detach them somehow. Consider the following shell script long-live-the-subshell.sh : #!/bin/sh ( echo sleeping...>&2; sleep 5; echo woke up >&2 ) | zenity --progress --auto-close --auto-kill To reproduce the mentioned behaviour: execute the script sh long-live-the-subshell.sh click Cancel on the progress bar wait another 5 seconds see

BASH - file selection by multiple patterns in zenity

蓝咒 提交于 2020-05-13 05:48:08
问题 Im pretty new to zenity and bash. Im trying to make file selection window that will display only the ones with .ogg, .aac and .wav extension. I tried this, but it doesn't work. option=`zenity --file-selection --file-filter=*.ogg | *.aac` For one extension it's working as intented: option=`zenity --file-selection --file-filter=*.ogg` Zenity man provides information: --file-filter=NAME | PATTERN1 PATTERN2 Sets a filename filter I dont really understand how am I supposed to use it. Can someone

Kali Linux 2020.1安装以及安装后要做的事

人走茶凉 提交于 2020-05-06 12:48:05
一、下载 https://www.kali.org/downloads/ 根据自己情况选择,我是要安装在虚拟机里,用不上live,所以我选的是 二、虚拟机安装 我的安装环境是Vmware 15.5,因为安装过程中需要联网,请准备好网络。 1、创建虚拟机 这里仅列出重要步骤 2、开始安装 域名要是没有需求可以添空 代理可以不填 图形界面选择自己喜欢的,其他都勾选上,我选择默认的Xfce。 开始较长的下载安装 一般会因为网络超时出点小问题,但没有关系,再来一次或几次就行。 如果出现了上述告警就再来一次,否则跳过下面两步重复步骤。 选择和上次一样, 图形界面选择自己喜欢的,其他都勾选上,我选择默认的Xfce。 下载的过程我重复了10几次。 软件安装完成后,走到这步就差不多没问题了。 此致安装结束 三、安装后需要做的事 1、更新软件源 sudo vi /etc/apt/sources.list 末尾添加: #浙大 deb http://mirrors.zju.edu.cn/kali kali-rolling main contrib non-free deb-src http://mirrors.zju.edu.cn/kali kali-rolling main contrib non-free #中科大 deb http://mirrors.ustc.edu.cn/kali kali

Two processes into Zenity progress- how to auto close?

醉酒当歌 提交于 2020-01-25 07:28:20
问题 I have a dirty way to show upload speed while my Youtube API uploader script runs, I measure the network output of a specific port, while the upload is in progress. My problem is that the data from the network port continues after the upload so the Zenity progress remains open, and doesnt auto-close - can't figure out how to get around this. I require $upl to pass the youtube ID to another portion of the script, so I'm not sure I quite have that right. (Comments added for clarity) #This is

Writing to stdin from PHP?

眉间皱痕 提交于 2019-12-30 09:00:23
问题 In linux I want to run a gnome zenity progress bar window from PHP. How zenity works is like this: linux-shell$ zenity --display 0:1 --progress --text='Backing up' --percentage=0 10 50 100 So the first command opens the zenity progress bar at 0 percent. Zenity then takes standard input numbers as the progress bar percentage (so it will go from 10% to 50% to 100% when you type those numbers in). I can't figure out how to get PHP to type in those numbers though, I have tried: exec($cmd); echo

Writing to stdin from PHP?

自作多情 提交于 2019-12-30 09:00:08
问题 In linux I want to run a gnome zenity progress bar window from PHP. How zenity works is like this: linux-shell$ zenity --display 0:1 --progress --text='Backing up' --percentage=0 10 50 100 So the first command opens the zenity progress bar at 0 percent. Zenity then takes standard input numbers as the progress bar percentage (so it will go from 10% to 50% to 100% when you type those numbers in). I can't figure out how to get PHP to type in those numbers though, I have tried: exec($cmd); echo

How to exit a Subshell

十年热恋 提交于 2019-12-25 07:40:11
问题 Basically, I am trying to exit a subshell that contains a loop. Here is the code: ` stop=0 ( # subshell start while true # Loop start do sleep 1 # Wait a second echo 1 >> /tmp/output # Add a line to a test file if [ $stop = 1 ]; then exit; fi # This should exit the subshell if $stop is 1 done # Loop done ) | # Do I need this pipe? while true do zenity --title="Test" --ok-label="Stop" --cancel-label="Refresh" --text-info --filename=/tmp/output --font=couriernew # This opens Zenity and shows

Using Zenity in a root incron job to display message to currently logged in user

不羁的心 提交于 2019-12-13 18:26:58
问题 Working on a script to auto-upload files that are placed in a directory, and then display a link to them to the currently logged in user. Users of the machine will be authenticated via LDAP. The directory that is being watched by incron is outside of any of the users' directories, and is symlinked to the /home/username/uploads directory for each user. When a user places a file here, it automatically uploads without issue. Where I run into problems is displaying the file URL to the current

Using a variable as another variable in a bash script?

江枫思渺然 提交于 2019-12-13 05:24:47
问题 Hi I'm kinda new to bash scripting and not very technical when it comes to writing my own scripts, I have a script that works perfectly in a terminal. I wanted to use zenity to make things nice and simple and straight forward (but also as a little learning project). The script generates random passwords and with zenity is quite a good little tool. I have run into a problem though, the script runs well as a GUI but when I wanted to introduce a way for the user to choose the length of the