i3status → py3status
This commit is contained in:
parent
1ad3818c4d
commit
6b2beaf940
4 changed files with 93 additions and 1 deletions
17
files/.config/i3/bin/calendar-widget
Executable file
17
files/.config/i3/bin/calendar-widget
Executable file
|
@ -0,0 +1,17 @@
|
|||
#!/bin/bash
|
||||
# Toggles the calendar. If $1=x $2=y, the calendar bottom-right corner is
|
||||
# placed at x,y.
|
||||
|
||||
if ! ps -Ao "%c %u" | grep "orage" | grep -q "$(whoami)"; then
|
||||
# Orage non lancé
|
||||
orage > /dev/null 2>/dev/null &
|
||||
sleep 0.42
|
||||
fi
|
||||
|
||||
orage --toggle
|
||||
|
||||
if (( $# >= 2 )); then
|
||||
# sleep 0.2
|
||||
i3-msg [class='Orage'] move absolute position "$(($1 - 290))px" \
|
||||
"$(($2 - 215))px" > /dev/null
|
||||
fi
|
|
@ -199,7 +199,7 @@ bar {
|
|||
tray_output LVDS1
|
||||
# position top
|
||||
font pango:DejaVu Sans Mono, Awesome 8
|
||||
status_command i3status
|
||||
status_command py3status -dl /tmp/py3log
|
||||
# tray_output primary
|
||||
}
|
||||
|
||||
|
|
63
files/.i3/py3status/microphone.py
Normal file
63
files/.i3/py3status/microphone.py
Normal file
|
@ -0,0 +1,63 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Displays and controls the mute status of the default microphone.
|
||||
|
||||
Displays whether the current microphone is muted or not. A click on the icon
|
||||
will toggle this status. Relies on pulseaudio.
|
||||
|
||||
Configuration parameters:
|
||||
format_muted: text displayed when muted
|
||||
(default FontAwesome)
|
||||
format_unmuted: text displayed when unmuted
|
||||
(default FontAwesome)
|
||||
|
||||
Colors:
|
||||
color_mute: when muted
|
||||
color_unmute: when unmuted
|
||||
"""
|
||||
|
||||
import subprocess
|
||||
|
||||
|
||||
class Py3status:
|
||||
format_muted = '\uf131' # FontAwesome
|
||||
format_unmuted = '\uf130' # FontAwesome
|
||||
|
||||
class Error(Exception):
|
||||
pass
|
||||
|
||||
def microphone(self):
|
||||
isMute = self.__getMuteStatus__()
|
||||
color = self.py3.COLOR_MUTE if isMute else self.py3.COLOR_UNMUTE
|
||||
text = self.format_muted if isMute else self.format_unmuted
|
||||
return {
|
||||
'full_text': text,
|
||||
'color': color,
|
||||
}
|
||||
|
||||
def __getPaList__(self):
|
||||
try:
|
||||
paOutput = subprocess.check_output(["pacmd", "list-sources"])
|
||||
except CalledProcessError:
|
||||
raise Error()
|
||||
|
||||
return paOutput.decode()
|
||||
|
||||
def __getMuteStatus__(self):
|
||||
paList = self.__getPaList__()
|
||||
fromCurrent = paList[paList.find('* index:'):]
|
||||
MUTED_STR = 'muted: '
|
||||
fromMutestat = fromCurrent[fromCurrent.find(MUTED_STR)
|
||||
+ len(MUTED_STR):]
|
||||
return fromMutestat[:3] == 'yes'
|
||||
|
||||
def __toggleMuteStatus__(self):
|
||||
isMuted = self.__getMuteStatus__()
|
||||
paList = self.__getPaList__()
|
||||
fromCurrent = paList[paList.find('* index: ')+len('* index: '):]
|
||||
sourceId = int(fromCurrent[:fromCurrent.find('\n')])
|
||||
subprocess.call(['pacmd', 'set-source-mute', str(sourceId),
|
||||
str(int(not isMuted))])
|
||||
|
||||
def on_click(self, event):
|
||||
self.__toggleMuteStatus__()
|
|
@ -21,11 +21,22 @@ order += "path_exists VPN"
|
|||
order += "wireless wlo1"
|
||||
order += "ethernet eno1"
|
||||
#order += "volume master"
|
||||
order += "microphone"
|
||||
order += "battery 1"
|
||||
order += "arch_updates"
|
||||
order += "load"
|
||||
order += "cpu_temperature 0"
|
||||
order += "tztime local"
|
||||
|
||||
arch_updates {
|
||||
format = "\uf0ed {pacman}"
|
||||
}
|
||||
|
||||
microphone {
|
||||
color_unmute = "#E73235"
|
||||
color_mute = "#FFFFFF"
|
||||
}
|
||||
|
||||
volume master {
|
||||
format = " %volume"
|
||||
format_muted = " %volume"
|
||||
|
@ -68,6 +79,7 @@ run_watch VPN {
|
|||
|
||||
tztime local {
|
||||
format = "%d-%m-%Y %H:%M"
|
||||
on_click 1 = "exec /home/tobast/.config/i3/bin/calendar-widget $X_POS $Y_POS &"
|
||||
}
|
||||
|
||||
load {
|
||||
|
|
Loading…
Reference in a new issue