From 27703c6949a3964b41bf2f8f04a1390a4370391f Mon Sep 17 00:00:00 2001 From: julian Date: Thu, 29 Oct 2020 12:31:05 +0100 Subject: [PATCH] Changed calendar to firefox. --- i3blocks/calendar | 25 ++++++++----------------- i3blocks/config | 2 +- i3blocks/volume | 4 ++-- 3 files changed, 11 insertions(+), 20 deletions(-) diff --git a/i3blocks/calendar b/i3blocks/calendar index 4ec7d81..b05d7b9 100755 --- a/i3blocks/calendar +++ b/i3blocks/calendar @@ -1,7 +1,5 @@ -#! /bin/sh +#!/bin/bash -WIDTH=${WIDTH:-200} -HEIGHT=${HEIGHT:-200} DATEFMT=${DATEFMT:-"+%a %d.%m.%Y %H:%M:%S"} SHORTFMT=${SHORTFMT:-"+%H:%M:%S"} @@ -12,8 +10,8 @@ while getopts ":f:W:H:" opt; do W) WIDTH="$OPTARG" ;; H) HEIGHT="$OPTARG" ;; \?) - echo "Invalid option: -$OPTARG" >&2 - exit 1 + echo "Invalid option: -$OPTARG" >&2 + exit 1 ;; :) echo "Option -$OPTARG requires an argument." >&2 @@ -23,18 +21,11 @@ while getopts ":f:W:H:" opt; do done case "$BLOCK_BUTTON" in - 1|2|3) - - # the position of the upper left corner of the popup - posX=$(($BLOCK_X - $WIDTH / 2)) - posY=$(($BLOCK_Y - $HEIGHT)) - - i3-msg -q "exec yad --calendar \ - --width=$WIDTH --height=$HEIGHT \ - --undecorated --fixed \ - --close-on-unfocus --no-buttons \ - --posx=$posX --posy=$posY \ - > /dev/null" + 1|2|3) + # Focus Thunderbird and open calendar + i3-msg -q [class="Thunderbird" instance="Mail"] focus; \ + sleep 0.005; \ + xdotool key --clearmodifiers --delay 5 ctrl+shift+c esac echo "$LABEL$(date "$DATEFMT")" echo "$LABEL$(date "$SHORTFMT")" diff --git a/i3blocks/config b/i3blocks/config index fafd9a5..d370a58 100644 --- a/i3blocks/config +++ b/i3blocks/config @@ -13,7 +13,7 @@ separator_block_width=15 [volume] command=./volume LABEL= -interval=once +interval=10 signal=10 [calendar] diff --git a/i3blocks/volume b/i3blocks/volume index 45e085d..cf56783 100755 --- a/i3blocks/volume +++ b/i3blocks/volume @@ -77,13 +77,13 @@ format() { perl_filter+=$([[ $STEP = *dB ]] && echo '$3' || echo '$1') perl_filter+='"; exit}' output=$(perl -ne "$perl_filter") - echo "$LABEL$output" + echo "$LABEL $output" } #------------------------------------------------------------------------ case $BLOCK_BUTTON in - 3) pavucontrol ;; # right click, open gui + 1|2|3) pavucontrol ;; # right click, open gui 4) amixer $AMIXER_PARAMS -q -D $MIXER sset $SCONTROL $(capability) ${STEP}+ unmute ;; # scroll up, increase 5) amixer $AMIXER_PARAMS -q -D $MIXER sset $SCONTROL $(capability) ${STEP}- unmute ;; # scroll down, decrease esac