Created
October 19, 2018 16:23
-
-
Save matt-fff/61b2224908c0b8c890e71abf2c958a15 to your computer and use it in GitHub Desktop.
conky configuration (.desktop files in ~/.config/autostart/)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Desktop Entry] | |
Exec=~/Workspaces/monitor_change.py | |
Name=Conky Automatic Restart | |
Comment=Run Conky automatic restart on monitor change | |
Type=Application | |
Icon=video-joined-displays-symbolic | |
NoDisplay=true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Desktop Entry] | |
Exec=conky | |
Name=Conky System Monitor | |
Comment=Run Conky system monitor | |
Type=Application | |
Icon=conky-manager | |
NoDisplay=true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import subprocess | |
import time | |
def get(cmd): return subprocess.check_output(cmd).decode("utf-8") | |
def count_screens(xr): return xr.count(" connected ") | |
# first count | |
xr1 = None | |
while True: | |
time.sleep(5) | |
# second count | |
xr2 = count_screens(get(["xrandr"])) | |
# check if there is a change in the screen state | |
if xr2 != xr1: | |
subprocess.Popen(["/usr/bin/pkill", "-f", "conky"]) | |
time.sleep(5) | |
subprocess.Popen(["/usr/bin/conky"]) | |
# set the second count as initial state for the next loop | |
xr1 = xr2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment