Browse Source

i3blocks ntfy

master
parent
commit
5c68275e75
8 changed files with 51 additions and 8 deletions
  1. +1
    -1
      files/bin/i3-watchers
  2. +8
    -0
      files/bin/i3blocks-ntfy.sh
  3. +13
    -1
      tasks/i3.yaml
  4. +11
    -0
      templates/i3/i3-watchers.service.j2
  5. +11
    -0
      templates/i3/i3-watchers@.service.j2
  6. +0
    -3
      templates/i3/i3.config.j2
  7. +6
    -3
      templates/i3/i3blocks.config.j2
  8. +1
    -0
      templates/i3/i3wm.service.j2

+ 1
- 1
files/bin/i3-watchers View File

@@ -2,4 +2,4 @@

set DIR (cd (dirname (status -f)); and pwd)

i3-msg -t subscribe -m '["workspace"]' | jq --raw-output --unbuffered 'select(.change == "focus").current.name' | xargs -n1 -r on-focus-workspace &
i3-msg -t subscribe -m '["workspace"]' | jq --raw-output --unbuffered 'select(.change == "focus").current.name' | xargs -n1 -r on-focus-workspace

+ 8
- 0
files/bin/i3blocks-ntfy.sh View File

@@ -0,0 +1,8 @@
#!/bin/bash
ntfy_url=$1
while echo  offline
do
curl -sN --proto-default https --retry 60 --retry-delay 1 --retry-max-time 60 --keepalive-time 1 $ntfy_url |\
jq --unbuffered -r 'select(.event == "message" or .event == "open")|if .event == "message" then .message else "🖧 online" end';
sleep 1;
done

+ 13
- 1
tasks/i3.yaml View File

@@ -36,6 +36,18 @@
dest: ~/.config/i3blocks/config
notify: i3 reload

- name: i3-watchers service for the default xsession
template:
src: i3/i3-watchers.service.j2
dest: ~/.config/systemd/user/i3-watchers.service
notify: systemd daemon-reload

- name: i3-watchers service for specific displays
template:
src: i3/i3-watchers@.service.j2
dest: ~/.config/systemd/user/i3-watchers@.service
notify: systemd daemon-reload

- name: i3wm graphical-session service for the default xsession
template:
src: i3/i3wm.service.j2
@@ -50,6 +62,6 @@

- name: i3wm graphical-session service enabled
systemd:
name: i3wm@.service
name: i3wm.service
enabled: true
scope: user

+ 11
- 0
templates/i3/i3-watchers.service.j2 View File

@@ -0,0 +1,11 @@
{{ ansible_managed | comment }}

[Unit]
PartOf=graphical-session.target
Requires=i3wm.service

[Service]
ExecStart=/usr/bin/env i3-watchers

[Install]
RequiredBy=xsession.target

+ 11
- 0
templates/i3/i3-watchers@.service.j2 View File

@@ -0,0 +1,11 @@
[Unit]
Description=i3 Window Manager for Display %i
Requires=i3wm@%i.service

[Service]
Environment=DISPLAY=%i
Environment=XAUTHORITY=%h/.Xauthority%i
ExecStart=/usr/bin/env i3-watchers

[Install]
WantedBy=default.target

+ 0
- 3
templates/i3/i3.config.j2 View File

@@ -368,6 +368,3 @@ assign [title="^Citrix maximized probe window$"] → citrix
{% set ws = workspaces[workspace] %}
assign [class="^(?:Tiger)?V[Nn][Cc] ?[Vv]iewer$" title="^{{ws.host}}:{{ws.display|default(home_vncserver_display_number)}}"] → {{workspace}}
{% endfor %}

# Autostart
exec --no-startup-id i3-watchers

+ 6
- 3
templates/i3/i3blocks.config.j2 View File

@@ -30,17 +30,20 @@ command=/usr/share/i3blocks/$BLOCK_NAME
separator_block_width=15
markup=none

{% if i3blocks_ntfy_url is defined %}
# todo
[todo]
command=i3block-socket-watcher {{todo_i3block_socket}}
[ntfy]
command=i3blocks-ntfy.sh {{ i3blocks_ntfy_url | quote }}
interval=persist
markup=pango
{% endif %}

{#
# timer
[timer]
command=i3block-socket-watcher {{timer_i3block_socket}}
interval=persist
markup=pango
#}

# hostinfo
[hostinfo]


+ 1
- 0
templates/i3/i3wm.service.j2 View File

@@ -1,6 +1,7 @@
[Unit]
Description=i3 Window Manager
PartOf=graphical-session.target
Wants=i3-watchers.service

[Service]
Type=exec