This file contains 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 python | |
import gi | |
gi.require_version('Gtk', '3.0') | |
from gi.repository import GdkX11, Gdk, Gtk | |
def main(): | |
DEBUG = True |
This file contains 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
import subprocess | |
import os | |
import sys | |
# This is a function that simplifies calling | |
# commands. Instead of writing that same try-except | |
# block over and over, write it once | |
def run_cmd(cmdlist): | |
proc = None |
This file contains 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 python | |
from gi.repository import Notify | |
import subprocess | |
from time import sleep, time | |
from sys import argv | |
import dbus | |
def send_notification(title, text): | |
try: |
This file contains 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
import gi | |
gi.require_version('Notify', '0.7') | |
from gi.repository import Notify | |
import subprocess | |
import os | |
import sys | |
def send_notif(n,title, text): | |
try: | |
if Notify.init(__file__): |
This file contains 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
from gi.repository import GdkX11,Gdk | |
import subprocess | |
import time | |
def run_sh(cmd): | |
# run shell commands | |
p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE) | |
out = p.stdout.read().strip() | |
return out |
This file contains 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
#!/bin/bash | |
set -e # bail if anything goes wrong | |
is_root(){ | |
if [ "$( id -u )" -ne 0 ] ; then | |
return 1 | |
fi | |
return 0 | |
} |
This file contains 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
#!/bin/bash | |
# We want to find the directory where all the backlight data | |
# is stored , based on the fact that there's always "actual_brightness" | |
# file in that directory | |
DIR=$(find /sys/devices/ -type f -name "actual_brightness" -printf "%h" ) | |
# Graphic cards all have different integer value for | |
# maximum level of brightness, so we need to get it | |
MAX=$(cat "$DIR"/max_brightness ) |
This file contains 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 python | |
# -*- coding: utf-8 -*- | |
from gi.repository import Gio,Notify | |
import dbus | |
import sys | |
import os | |
import time | |
import subprocess | |
def get_dbus(bus_type,obj,path,interface,method,arg): |
This file contains 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
#!/bin/bash | |
# run script like so: bash thirds.sh NUMBER | |
# where NUMBER is 0,1 or 2 | |
# 0 is left, 1 is center, 2 is right | |
get_screen_geometry() | |
{ | |
# determine size of the desktop | |
xwininfo -root | \ | |
awk -F ':' '/Width/{printf "%d",$2/3}/Height/{print $2}' | |
} |
This file contains 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
#!/bin/bash | |
list_windows() | |
{ | |
# get list of all currently open windows | |
qdbus org.ayatana.bamf \ | |
/org/ayatana/bamf/matcher \ | |
org.ayatana.bamf.matcher.WindowPaths | |
} |