Selaa lähdekoodia

Display keyboard layout using new i3status wrapper *i3staplus*

Alois Mahdal 7 vuotta sitten
vanhempi
commit
7598a2b51f
3 muutettua tiedostoa jossa 31 lisäystä ja 1 poistoa
  1. 29
    0
      dotfiles/i3/bin/i3staplus
  2. 1
    1
      dotfiles/i3/config
  3. 1
    0
      dotfiles/i3status.conf

+ 29
- 0
dotfiles/i3/bin/i3staplus Näytä tiedosto

@@ -0,0 +1,29 @@
1
+#!/bin/dash
2
+
3
+# prepend i3status with more stuff
4
+
5
+mkfield() {
6
+    local layout
7
+    local color
8
+    layout=$(
9
+        setxkbmap -query \
10
+          | awk '/layout/{print $2}'
11
+    )
12
+    case $layout in
13
+        us) color='' ;;
14
+        *)  color=',"color": "red"' ;;
15
+    esac
16
+    printf '{"full_text": " %s"%s}' \
17
+        "$layout" "$color"
18
+}
19
+
20
+i3status \
21
+  | while true
22
+    do
23
+        read line
24
+        case $line in
25
+            '[{'*)  line="[$(mkfield),{${line#\[\{}" ;;
26
+            ',[{'*) line=",[$(mkfield),{${line#,\[\{}" ;;
27
+        esac
28
+        echo "$line"
29
+    done

+ 1
- 1
dotfiles/i3/config Näytä tiedosto

@@ -174,7 +174,7 @@ mode "resize" {
174 174
 }
175 175
 
176 176
 bar {
177
-        status_command i3status
177
+        status_command "~/.i3/bin/i3staplus"
178 178
         bindsym button2 exec thunar
179 179
         bindsym button3 exec "$spn xclose"
180 180
         separator_symbol "•"

+ 1
- 0
dotfiles/i3status.conf Näytä tiedosto

@@ -9,6 +9,7 @@
9 9
 general {
10 10
         colors = true
11 11
         interval = 5
12
+        output_format = i3bar
12 13
 }
13 14
 
14 15
 order += "battery 0"