- Notifications
You must be signed in to change notification settings - Fork3
Package of info scripts for Tint2 or other panels
License
nwg-piotr/t2ec
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Collection of scripts to provide system information and controls as icons or textual display. Aimed atTint2, possible to apply in other panels. Also check thepsuinfo project.
Same aspsuinfo, these scripts were originally developed within thetint2-executors project, and a number of people contributed to it:
- edskeye is the author of all icons, and also a tester from the very beginning;
- natemaia improved the
t2ec --volume
command (later I applied similar solution in several other scripts); - johanmalm provided the idea and a code snippet to attachjgmenu;
- PackRat,Head_on_a_Stick,sevenday4 have always good ideas.
Many thanks to you all!
t2ec --script [argument] [argument]
t2ec --volume
- to draw the volume icon + current volume level
t2ec --volume -N
- to print "Vol: 20%" instead of the icon
t2ec --volume [up] | [down] | [toggle] | [level]
- to use as mouse event commands
Together with thepsuinfo package, all the most useful scripts are now unified and given similar syntax:
Please install thet2ec package (AUR).
Forpsuinfo
commands install thepsuinfo package (AUR).
[-N]
replaces icons with text:
t2ec --desktop [-N]
t2ec --bbswitch [-N]
t2ec --volume [-N]
t2ec --brightness [-N]
t2ec --lbrightness [-N]
(forligh
optional package)
t2ec --battery [-l] | [-N]
([-l]
for icon + level,[-N]
for "Bri: " + level
t2ec --wifi [-N] | [-M'custom name']
t2ec --update -C[pacaur | trizen | yay] [-N] | [-M<custom_name]
read more
t2ec --weather [-I<items>] [-A<api_key>] [-C<city_id>] [-U<units>] [-L<lang>]
read more
t2ec --desktop [next] | [prev] | [<number>]
t2ec --volume [up] | [down] | [toggle] | [<level>]
t2ec --paswitch
(assign to the volume icon click event to switch audio output with jgmenu)
t2ec --brightness [up] | [down] | [<level>]
t2ec --lbrightness [up] | [down] | [<level>]
(for 'light-git' optional package)
t2ec --update -U<terminal>[:aur_helper]
t2ec --update -O
displays n(O)tifiction with the last saved updates list
t2ec --weather -D[<city_id>]
Remember to uncheck 'Show icon' in executor if textual display selected!
t2ec --command menu
- assigned to a mouse event (preferrably left/right click) allows to attach context menus to executors.
You need thejgmenu package (optional dependency) installed and initialized (jgmenu init
).
Two of the commands have predefined menus:t2ec --update menu
andt2ec --desktop menu
will display:
Other commands launched with themenu
argument will use a sample template. All templates are beingcreated in the~/.t2ecol
hidden folder as soon, as you run the command for the first time.You may customize templates to your taste. To restore defaults, just remove the modified template.
Check thejgmenu reference document to learn more.
t2ec --zbox [bri] | [vol]
- displays Zenity box to set volume | brightness level. Depends on 'zenity' and 'rof-git' optional packages.
This command may need some further clarification. To benefit from all its features, you should install thejgmenu
optional package, and assignt2ec --update menu
to the left click event:
Also the "Continous output" field is necessary. For graphical output (e.g.t2ec --update -Ctrizen
) please setexecp_continuous = 2
. For textual output (e.g.t2ec --update -Ctrizen -N
setexecp_continuous = 1.
You need to edit the~/.t2ecol/menu-update.sh
template, as your AUR helper and terminal are defined here. Defaultyay andtermite may, or may not work for you.
#!/bin/shconfig_file=$(mktemp)menu_file=$(mktemp)trap"rm -f${config_file}${menu_file}" EXITcat<<'EOF' >${config_file}stay_alive = 0tint2_look = 1menu_width = 40menu_border = 1item_height = 20font = Sans 10icon_size = 0color_norm_fg = #eeeeee 100color_sel_fg = #eeeeee 100EOFcat<<'EOF' >${menu_file}Check updates,t2ec --CyayShow pending,t2ec --update -OUpdate,t2ec --update -Utermite:yayEOFjgmenu --config-file=${config_file} --csv-file=${menu_file}
This script retrieves and displays weather data fromhttp://openweathermap.org © 2012 — 2018 OpenWeatherMap, Inc.
Icon display:
t2ec --weather
"Show icons" and"Cache icons" checked.Continous output = 2.
Textual display:
t2ec --weather -N | -M"My own text here"
(or just-M
for no name)
"Show icons" unchecked.Continous output = 1.
t2ec --weather -D[<city_id>]
Assign the command above to a mouse click event. Optional<city_id>
you only need if the executor displays data for another city than specified in the config file (see below).
At the first use, the script creates the~/.t2ecol/weatherrc
config file. You need to edit at least 2 values.
items = ctapi_key = your_api_key_kerecity_id = 2643743units = metric#lang = en#img_path = /home/user/my_custom_icons/# You may translate your output below:#_weather = Weather in_wind = Wind_cloudiness = Cloudiness_pressure = Pressure_humidity = Humidity_sunrise = Sunrise_sunset = Sunset
- Obtain an API key athttp://openweathermap.org, enter it in the
api_key
field; - find your city ID athttps://openweathermap.org/find, enter in the
city_id
field. - You may also replace default
metric
units withimperial
, if you need to.
Theitems
field defines data components to be shown:
[c]ity name, [s]hort description, [d]escription, [t]emperature, [p]ressure, [h]umidity, [w]ind
The script uses the system $LANG variable by default. In case it didn't work for you, or you just wanted another language, uncomment the#lang = en
line, and replace English with your own lang code (2 chars).
If default icons by @edskeye don't go well with your desktop layout, you may uncomment the#img_path = /home/user/my_custom_icons/
line and enter a path to own icons. Originals you'll find in/usr/share/t2ec/ow*-svg
.
This small script does not really provide internalization. However, you may translate the display into your language by editing fields which names start from_
, e.g.:
_weather = Pogoda w
for "Weather in" in Polish.
Since v1.3 it's possible to display sunrise and sunset in the panel. Use the [S] in the command, e.g.:
t2ec --weather -IcstS
It makes sense to edit~/.t2ecol/weatherrc
and replaceSunrise
andSunset
with appropriate glyphs.The symbols below come from the icomoon font.
If you need to see data for more than one location, you may override default~/.t2ec/weatherrc
config setting:
t2ec --weather [-I<items>] [-A<api_key>] [-C<city_id>] [-U<metric>|<imperial>] [-L<lang>]
If you specified<city_id>
in the main command, to see relevant data in the details notification you also need to do so:
t2ec --weather -D<city_id>
v1.3-2 Bug in
t2ec --weather
command hopefully fixed: unwanted accidental~/wget-log*
files are now being sent to /dev/null.v1.3-1 [S]unrise/sunset panel item added; temperature units formatting altered.
v1.2-1 The
t2ec --paswitch
command added. It creates jgmenu to switch PulseAudio output.v1.1-3 Fix to vulnerability causing ValueError on numeric field names in openwathermap JSON.
v1.1-2 Error handling for locale.getdefaultlocale() TypeError in the weather.py script.
v1.1-1 Initial release as a separate project.
About
Package of info scripts for Tint2 or other panels