Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nwg-piotr/t2ec
Package of info scripts for Tint2 or other panels
https://github.com/nwg-piotr/t2ec
archlinux i3wm openbox tint2 tint2-executors
Last synced: 3 months ago
JSON representation
Package of info scripts for Tint2 or other panels
- Host: GitHub
- URL: https://github.com/nwg-piotr/t2ec
- Owner: nwg-piotr
- License: gpl-3.0
- Created: 2018-12-19T11:39:29.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-01-28T23:43:32.000Z (about 3 years ago)
- Last Synced: 2024-06-22T00:54:17.348Z (8 months ago)
- Topics: archlinux, i3wm, openbox, tint2, tint2-executors
- Language: Python
- Size: 183 KB
- Stars: 16
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# t2ec
[![Packaging status](https://repology.org/badge/vertical-allrepos/t2ec.svg)](https://repology.org/metapackage/t2ec/versions)
Collection of scripts to provide system information and controls as icons or textual display. Aimed at [Tint2](https://gitlab.com/o9000/tint2), possible to apply in other panels. Also check the [psuinfo](https://github.com/nwg-piotr/psuinfo) project.
___
Same as [psuinfo](https://github.com/nwg-piotr/psuinfo), these scripts were originally developed within the [tint2-executors](https://github.com/nwg-piotr/tint2-executors) project, and a number of people contributed to it:- [edskeye](https://github.com/edskeye) is the author of all icons, and also a tester from the very beginning;
- [natemaia](https://github.com/natemaia) improved the `t2ec --volume` command (later I applied similar solution in several other scripts);
- [johanmalm](https://github.com/johanmalm) provided the idea and a code snippet to attach [jgmenu](https://github.com/johanmalm/jgmenu);
- [PackRat](https://github.com/PackRat-SC2018), [Head_on_a_Stick](https://forum.archlabslinux.com/u/head_on_a_stick/summary), [sevenday4](https://forum.archlabslinux.com/u/sevenday4) have always good ideas.Many thanks to you all!
___```bash
t2ec --script [argument] [argument]
```## Example:
`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 the [psuinfo](https://github.com/nwg-piotr/psuinfo) package, all the most useful scripts are now unified and given similar syntax:
![scripts in action](http://nwg.pl/wiki-tint2-executors/my-panels-201218.jpg)
## Installation:
Please install the [t2ec package](https://aur.archlinux.org/packages/t2ec) (AUR).
For `psuinfo` commands install the [psuinfo package](https://aur.archlinux.org/packages/psuinfo) (AUR).
## Commands to display information
`[-N]` replaces icons with text:`t2ec --desktop [-N]`
`t2ec --bbswitch [-N]`
`t2ec --volume [-N]`
`t2ec --brightness [-N]`
`t2ec --lbrightness [-N]` (for `ligh` 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] [-A] [-C] [-U] [-L]` [read more](https://github.com/nwg-piotr/t2ec#t2ec---weather)
## Commands to assign to mouse events:
`t2ec --desktop [next] | [prev] | []`
`t2ec --volume [up] | [down] | [toggle] | []`
`t2ec --paswitch` (assign to the volume icon click event to switch audio output with jgmenu)
`t2ec --brightness [up] | [down] | []`
`t2ec --lbrightness [up] | [down] | []` (for 'light-git' optional package)
`t2ec --update -U[:aur_helper]`
`t2ec --update -O` displays n(O)tifiction with the last saved updates list
`t2ec --weather -D[]`
*Remember to uncheck 'Show icon' in executor if textual display selected!*
## Menus:
`t2ec --command menu` - assigned to a mouse event (preferrably left/right click) allows to attach context menus to executors.
You need the [jgmenu](https://github.com/johanmalm/jgmenu) package (optional dependency) installed and initialized (`jgmenu init`).
Two of the commands have predefined menus: `t2ec --update menu` and `t2ec --desktop menu` will display:
![predefined menus](http://nwg.pl/wiki-tint2-executors/t2ec-menus-predefined.png)
Other commands launched with the `menu` argument will use a sample template. All templates are being
created 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 the [jgmenu reference document](https://github.com/johanmalm/jgmenu/blob/master/docs/manual/jgmenu.1.md) to learn more.
## Helper command:
`t2ec --zbox [bri] | [vol]` - displays Zenity box to set volume | brightness level. Depends on 'zenity' and 'rof-git' optional packages.
## Sample usage in Tint2:
![sample executor](http://nwg.pl/wiki-tint2-executors/tint2conf-commented.png)
## t2ec --update command
This command may need some further clarification. To benefit from all its features, you should install the `jgmenu` optional package, and assign `t2ec --update menu` to the left click event:
![t2ec --update](http://nwg.pl/wiki-tint2-executors/t2ec-update.png)
Also the "Continous output" field is necessary. For graphical output (e.g. `t2ec --update -Ctrizen`) please set `execp_continuous = 2`. For textual output (e.g. `t2ec --update -Ctrizen -N` set `execp_continuous = 1.`
### t2ec --update menu
You need to edit the `~/.t2ecol/menu-update.sh` template, as your AUR helper and terminal are defined here. Default **yay** and **termite** may, or may not work for you.
```bash
#!/bin/shconfig_file=$(mktemp)
menu_file=$(mktemp)
trap "rm -f ${config_file} ${menu_file}" EXITcat <<'EOF' >${config_file}
stay_alive = 0
tint2_look = 1
menu_width = 40
menu_border = 1
item_height = 20
font = Sans 10
icon_size = 0
color_norm_fg = #eeeeee 100
color_sel_fg = #eeeeee 100
EOFcat <<'EOF' >${menu_file}
Check updates,t2ec --Cyay
Show pending,t2ec --update -O
Update,t2ec --update -Utermite:yay
EOFjgmenu --config-file=${config_file} --csv-file=${menu_file}
```## t2ec --weather
This script retrieves and displays weather data from [http://openweathermap.org](http://openweathermap.org) © 2012 — 2018 OpenWeatherMap, Inc.
![t2ec --weather](http://nwg.pl/wiki-tint2-executors/weather.png)
### Executor:
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.
### Details notification:
`t2ec --weather -D[]`
Assign the command above to a mouse click event. Optional `` you only need if the executor displays data for another city than specified in the config file (see below).
### Configuration:
At the first use, the script creates the `~/.t2ecol/weatherrc` config file. You need to edit at least 2 values.
```
items = ct
api_key = your_api_key_kere
city_id = 2643743
units = 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
```1. Obtain an API key at [http://openweathermap.org](http://openweathermap.org), enter it in the `api_key` field;
2. find your city ID at [https://openweathermap.org/find](https://openweathermap.org/find), enter in the `city_id` field.
3. You may also replace default `metric` units with `imperial`, if you need to.The `items` 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.
#### Sunrise/sunset in the panel:
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 replace `Sunrise` and `Sunset` with appropriate glyphs.
The symbols below come from the icomoon font.![t2ec --weather](http://nwg.pl/wiki-tint2-executors/t2ec-weather-IS.png)
### Overriding weatherrc settings:
If you need to see data for more than one location, you may override default `~/.t2ec/weatherrc` config setting:
```
t2ec --weather [-I] [-A] [-C] [-U|] [-L]
```If you specified `` in the main command, to see relevant data in the details notification you also need to do so:
`t2ec --weather -D`
## CHANGELOG
- 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.