Added zoom and keyboard
This commit is contained in:
@@ -4,11 +4,9 @@ DATEFMT=${DATEFMT:-"+%a %d.%m.%Y %H:%M:%S"}
|
||||
SHORTFMT=${SHORTFMT:-"+%H:%M:%S"}
|
||||
|
||||
OPTIND=1
|
||||
while getopts ":f:W:H:" opt; do
|
||||
while getopts ":f:" opt; do
|
||||
case $opt in
|
||||
f) DATEFMT="$OPTARG" ;;
|
||||
W) WIDTH="$OPTARG" ;;
|
||||
H) HEIGHT="$OPTARG" ;;
|
||||
\?)
|
||||
echo "Invalid option: -$OPTARG" >&2
|
||||
exit 1
|
||||
@@ -22,10 +20,16 @@ done
|
||||
|
||||
case "$BLOCK_BUTTON" in
|
||||
1|2|3)
|
||||
# Focus Thunderbird and open calendar
|
||||
i3-msg -q [class="Thunderbird" instance="Mail"] focus; \
|
||||
sleep 0.005; \
|
||||
# Try to focus Thunderbird
|
||||
i3-msg -q [class="Thunderbird" instance="Mail"] focus
|
||||
if [ $? == 2 ]
|
||||
then
|
||||
# Open Thunderbird if it was not open
|
||||
i3-msg -q "exec thunderbird -mail -calendar"
|
||||
else
|
||||
# Open calendar
|
||||
xdotool key --clearmodifiers --delay 5 ctrl+shift+c
|
||||
fi
|
||||
esac
|
||||
echo "$LABEL$(date "$DATEFMT")"
|
||||
echo "$LABEL$(date "$SHORTFMT")"
|
||||
|
35
i3blocks/calendar.test
Normal file
35
i3blocks/calendar.test
Normal file
@@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
|
||||
DATEFMT=${DATEFMT:-"+%a %d.%m.%Y %H:%M:%S"}
|
||||
SHORTFMT=${SHORTFMT:-"+%H:%M:%S"}
|
||||
|
||||
OPTIND=1
|
||||
while getopts ":f:" opt; do
|
||||
case $opt in
|
||||
f) DATEFMT="$OPTARG" ;;
|
||||
\?)
|
||||
echo "Invalid option: -$OPTARG" >&2
|
||||
exit 1
|
||||
;;
|
||||
:)
|
||||
echo "Option -$OPTARG requires an argument." >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
case "$BLOCK_BUTTON" in
|
||||
1|2|3)
|
||||
# Try to focus Thunderbird
|
||||
i3-msg -q [class="Thunderbird" instance="Mail"] focus
|
||||
if [ $? == 2 ]
|
||||
then
|
||||
# Open Thunderbird if it was not open
|
||||
i3-msg -q "exec thunderbird -mail -calendar"
|
||||
else
|
||||
# Open calendar
|
||||
xdotool key --clearmodifiers --delay 5 ctrl+shift+c
|
||||
fi
|
||||
esac
|
||||
echo "$LABEL$(date "$DATEFMT")"
|
||||
echo "$LABEL$(date "$SHORTFMT")"
|
@@ -16,7 +16,12 @@ LABEL=
|
||||
interval=10
|
||||
signal=10
|
||||
|
||||
[keyboard]
|
||||
command=./keyboard
|
||||
interval=10
|
||||
LABEL=
|
||||
|
||||
[calendar]
|
||||
command=./calendar
|
||||
interval=1
|
||||
LABEL=
|
||||
LABEL=
|
26
i3blocks/keyboard
Executable file
26
i3blocks/keyboard
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
|
||||
get_current_layout () {
|
||||
setxkbmap -print | grep -q dvorak
|
||||
if [ "$?" -eq "0" ]; then
|
||||
echo dvorak
|
||||
else
|
||||
echo qwertz
|
||||
fi
|
||||
}
|
||||
|
||||
case "$BLOCK_BUTTON" in
|
||||
1|2|3)
|
||||
# Switch layout
|
||||
current_layout=$(get_current_layout)
|
||||
if [ $current_layout == dvorak ]; then
|
||||
setxkbmap -layout de
|
||||
else
|
||||
setxkbmap -layout de -variant dvorak
|
||||
fi
|
||||
esac
|
||||
|
||||
current_layout=$(get_current_layout)
|
||||
|
||||
echo "$LABEL $current_layout"
|
||||
echo "$LABEL $current_layout"
|
Reference in New Issue
Block a user