fix datetime and readme

This commit is contained in:
koksnuss 2018-05-15 10:43:02 +02:00
parent 0621944365
commit 6ba071bebc
4 changed files with 37 additions and 19 deletions

View File

@ -17,12 +17,10 @@ backlight none, searches in /sys/class/backlight, intel and ati/amd supported
``` ```
# Install # Install
- If you already have a folder `~/.config/i3blocks` move it somewhere else: - Backup: `mv ~/.config/i3blocks{,.bak}`
`mv ~/.config/i3blocks{,.bak}` - Clone: `git clone https://will.kein.hk/git/koksnuss/simple-i3blocks.git ~/.config/i3blocks`
- Clone this repo to `~/.config/i3blocks`:
`git clone https://will.kein.hk/git/koksnuss/simple-i3blocks.git ~/.config/i3blocks`
- Make sure you've added `bar { status_command i3blocks }` in `~/config/i3/config`:
- Adjust `~/.config/i3blocks/config` to control i3 status bar output (see [Usage](#usage)). - Adjust `~/.config/i3blocks/config` to control i3 status bar output (see [Usage](#usage)).
- Make sure you've added `bar { status_command i3blocks }` in your i3-config file (i.e. `~/config/i3/config`).
- Finally reload your `i3` window manager. The default shortcut is `mod + SHIFT + r`, you should see a flickering. - Finally reload your `i3` window manager. The default shortcut is `mod + SHIFT + r`, you should see a flickering.
# Usage # Usage

24
config
View File

@ -7,15 +7,18 @@ interval=5
[backlight] [backlight]
# label=backlight # label=backlight
label= label=☼
# label=☀,☼,✱,✲,✳,✴,✵,✺
[storage] [storage]
# label=storage # label=storage
label= label=⛁
# label=⛀,⛁,⛂,⛃
# if you want to display ram and swap seperately, you can assign another [ram] module # if you want to display ram and swap seperately, you can assign another [ram] module
# with instance=ram or instance=swap # with instance=ram or instance=swap
[ram] [ram]
label=⚟
# label=ram # label=ram
# instance=ram # instance=ram
# [ram] # [ram]
@ -24,11 +27,12 @@ label=
# separator_block_width=0 # separator_block_width=0
[cpu] [cpu]
label=☷
# label=cpu # label=cpu
[ip] [ip]
# label=ip # label=ip
label= label=
interval=once interval=once
# if you have more than one batteries attached to your device and ou like # if you have more than one batteries attached to your device and ou like
@ -37,16 +41,28 @@ interval=once
[battery] [battery]
# label=battery # label=battery
# label=⚡ # label=⚡
# ▁▂▃▄▅▆▇█
# █
# ▉
# ▊
# ▋
# ▌
# ▍⎋
# ▎⌨
# ▏⟠, ⟰, ⟱, ⟲, ⟳, ⤋, ⤊,
# [battery] # [battery]
# instance=1 # instance=1
# separator_block_width=0 # separator_block_width=0
[audio] [audio]
# label=audio # label=audio
label=♪ label=◍
# label=♩,♪,♫,♬
separator_block_width=0 separator_block_width=0
[audio] [audio]
# label=mic # label=mic
label=◎
#label=⋓ℹ⋒ⅈ
instance=mic instance=mic
[datetime] [datetime]

View File

@ -26,7 +26,7 @@ cat $BATS | gawk -F '=' '
if (status == "") { if (status == "") {
status = $2 status = $2
if (status == "Discharging") { if (status == "Discharging") {
status = "" status = ""
} else if (status == "Charging") { } else if (status == "Charging") {
status = "⚡" status = "⚡"
} else { } else {

View File

@ -1,13 +1,17 @@
#!/bin/bash #!/bin/bash
FULL=$(date '+%A, %_d.%_m. %_H:%M:%S') FULL=$(date '+%A %-d.%-m.%Y W%V, %-H:%M:%S')
SHORT=$(date '+%_H:%M') SHORT=$(date '+%-H:%M')
a=$I3_LONG_DATETIME/1
[[ "$BLOCK_INSTANCE" == "short" ]] && export I3_LONG_DATETIME=false [[ "$BLOCK_INSTANCE" == "short" ]] && export I3_LONG_DATETIME=false
a+=$I3_LONG_DATETIME/2
[[ "$BLOCK_BUTTON" == "1" && $I3_LONG_DATETIME == "true" ]] && echo a; export I3_LONG_DATETIME=false; if [[ "$BLOCK_BUTTON" == "1" ]]; then
a+=$I3_LONG_DATETIME/3 if [[ "$I3_LONG_DATETIME" == "true" ]]; then
[[ "$BLOCK_BUTTON" == "1" && $I3_LONG_DATETIME == "false" ]] && echo b; export I3_LONG_DATETIME=true; export I3_LONG_DATETIME=false
a+=$I3_LONG_DATETIME/4 else
echo $a export I3_LONG_DATETIME=true
fi
fi
[[ "$I3_LONG_DATETIME" == "true" ]] && echo $FULL || echo $SHORT [[ "$I3_LONG_DATETIME" == "true" ]] && echo $FULL || echo $SHORT
echo $SHORT