Mod keys like alt or super are meant to be use in combination with others keys. When you are trying to assign a shortcut either on the i3 config or others programs like xbindkeys and xdotool, it is always expecting one of the modifiers keys plus the combination key. I do not think you will be able to map a command as soon as you press a modifier key, but maybe there is a way to do it.
The other issue that you seem to present is that you want to update the i3bar, and the right way to do it is through the i3status.conf
. You can actually use any programming language or a program that outputs data. My i3 bar consists of weather, bitcoin exchange rate, cpu load, temp, battery, dropbox status, wifi status, volume, date and time. All these I get by using tcl
to call commands and format the output with sed
, awk
, grep
and cut
.
The file output a JSON format that i3bar can understand, so basically you can use any programming language or program that outputs data and format it according to the i3 JSON guidelines.
Besides my program outputting all that data onto the i3bar, it will change color according to the status. For example, temp is green when is less than 65, yellow when is between 65 and 74 and red when is more than 74. Wifi and Dropbox are red when offline, and cpu load follows the same pattern. Another is the charge when laptop on batteries, it will turn red when less tha 20%.
Then you can add almost anything including things you can find on the web, like weather and exchange rates. Most programming languages have http apis that provides you with tools to extract information from webpages, and that's why the i3 bar is so powerful.
Tcl code is quite straight forward and you can look at the code and modify it in your programming language of choice and since most of the formatting is done using external programs like sed
and awk
. The only thing you need to be wary of is how tcl handles awk code, for example when in tcl code awk {{print $3}}
in other programming languages and awk itself is awk '{print $3}'
as there is special case how tcl handles single quotes, so it have to use curly braces instead.
On the i3.conf I got the following line to call my tcl file:
bar {
position top
status_command i3status --config ~/.config/i3/i3status.conf | ~/.config/i3/status.tcl
colors {
urgent_workspace #000000 #000000 #c0c0c0
}
}
Then my status.tcl
file:
#!/bin/tclsh
package require http
::http::config -useragent "Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Firefox/24.0"
set red "#FF0000"
set green "#00FF00"
set yellow "#FFF000"
set blue "#00EAFF"
set white "#FFFFFF"
puts {{"version":1}
[
[]}
proc dropbox {} {
catch { exec dropbox status} msg
set dropbox $msg
if {$dropbox=="Dropbox isn't running!" || [string match Connecting* $dropbox]} {
set stdout {{"name ...
(more)