summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMehdi Sadeghi <mehdi@mehdix.org>2021-06-11 17:13:48 +0200
committerMehdi Sadeghi <mehdi@mehdix.org>2021-06-11 17:14:52 +0200
commitda4ff3db82916d18029cfbdacf3f5866a391b7ba (patch)
treee91b387b0a01fabc350d7658b2fa4922c06569ba
parent5886d668f0216f0cc44894f6d71f97e8d95f255e (diff)
Add jdate to i3status. Use dmenu.
-rw-r--r--.config/i3status/config17
-rw-r--r--.config/sway/config9
-rw-r--r--.gnupg/gpg-agent.conf2
-rwxr-xr-x.local/bin/any_position_wrapper.sh55
4 files changed, 73 insertions, 10 deletions
diff --git a/.config/i3status/config b/.config/i3status/config
index f599ee6..55493fc 100644
--- a/.config/i3status/config
+++ b/.config/i3status/config
@@ -20,7 +20,8 @@ order += "wireless _first_"
order += "battery 0"
order += "volume master"
order += "load"
-order += "tztime local"
+#order += "tztime local"
+order += "tztime holder__jdate"
order += "tztime tehran"
wireless _first_ {
@@ -45,11 +46,6 @@ tztime local {
format = "%Y-%m-%d %H:%M:%S"
}
-tztime tehran {
- format = "Teh:%H:%M"
- timezone = "Asia/Tehran"
-}
-
load {
format = "%1min"
}
@@ -57,3 +53,12 @@ load {
disk "/" {
format = "%avail"
}
+
+tztime holder__jdate {
+ format = "holder__jdate"
+}
+
+tztime tehran {
+ format = "Teh %H:%M"
+ timezone = "Asia/Tehran"
+}
diff --git a/.config/sway/config b/.config/sway/config
index fa47ecc..490e3b7 100644
--- a/.config/sway/config
+++ b/.config/sway/config
@@ -4,11 +4,11 @@ set $down j
set $up k
set $right l
set $mod Mod4
-set $term alacritty -e bash --login
+set $term alacritty
# Note: pass the final command to swaymsg so that the resulting window can be opened
# on the original workspace that the command was run on.
-set $menu bemenu-run | xargs swaymsg exec --
+set $menu dmenu_path | dmenu | xargs swaymsg exec --
### Output configuration
#
@@ -237,7 +237,10 @@ bar {
}
bar {
- status_command i3status
+ # i3status does not allow running arbitrary processes.
+ # The man page describes the hack below to make it work.
+ #status_command i3status
+ status_command exec ~/.local/bin/any_position_wrapper.sh
}
# Load machine specific configuration
diff --git a/.gnupg/gpg-agent.conf b/.gnupg/gpg-agent.conf
index a70ae2c..23b4c0d 100644
--- a/.gnupg/gpg-agent.conf
+++ b/.gnupg/gpg-agent.conf
@@ -1 +1 @@
-pinentry-program /usr/bin/pinentry-bemenu
+pinentry-program /usr/bin/pinentry-dmenu
diff --git a/.local/bin/any_position_wrapper.sh b/.local/bin/any_position_wrapper.sh
new file mode 100755
index 0000000..d6c6afc
--- /dev/null
+++ b/.local/bin/any_position_wrapper.sh
@@ -0,0 +1,55 @@
+#!/usr/bin/env bash
+
+# This i3status wrapper allows to add custom information in any position of the statusline
+# It was developed for i3bar (JSON format)
+
+# The idea is to define "holder" modules in i3status config and then replace them
+
+# In order to make this example work you need to add
+# order += "tztime holder__hey_man"
+# and
+# tztime holder__hey_man {
+# format = "holder__hey_man"
+# }
+# in i3staus config
+
+# Don't forget that i3status config should contain:
+# general {
+# output_format = i3bar
+# }
+#
+# and i3 config should contain:
+# bar {
+# status_command exec /path/to/this/script.sh
+# }
+
+# Make sure jq is installed
+# That's it
+
+# You can easily add multiple custom modules using additional "holders"
+
+function update_holder {
+
+ local instance="$1"
+ local replacement="$2"
+ echo "$json_array" | jq --argjson arg_j "$replacement" "(.[] | (select(.instance==\"$instance\"))) |= \$arg_j"
+}
+
+function remove_holder {
+
+ local instance="$1"
+ echo "$json_array" | jq "del(.[] | (select(.instance==\"$instance\")))"
+}
+
+function irdate {
+ local json="{ \"full_text\": \"$(jdate '+%h %m %b %Y')\", \"color\": \"#00FF00\" }"
+ json_array=$(update_holder holder__jdate "$json")
+}
+
+i3status | (read line; echo "$line"; read line ; echo "$line" ; read line ; echo "$line" ; while true
+do
+ read line
+ json_array="$(echo $line | sed -e 's/^,//')"
+ irdate
+ echo ",$json_array"
+done)