summaryrefslogtreecommitdiff
path: root/Scripts/volume-change.py
diff options
context:
space:
mode:
authorJulian Teu <julianteule@gmail.com>2018-04-10 18:07:28 +0200
committerJulian Teu <julianteule@gmail.com>2018-04-10 18:07:28 +0200
commit3e00fc23117a6fbb91d5ca09602f8006c3f2365a (patch)
tree4e3f2288424a5c09e9815eff04719f620cd7b321 /Scripts/volume-change.py
parenta3443fca6351cbe9ecbbe29a32e358f7534a92a6 (diff)
Cleanup
Diffstat (limited to 'Scripts/volume-change.py')
-rwxr-xr-xScripts/volume-change.py56
1 files changed, 0 insertions, 56 deletions
diff --git a/Scripts/volume-change.py b/Scripts/volume-change.py
deleted file mode 100755
index d279ce6..0000000
--- a/Scripts/volume-change.py
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/usr/bin/python3
-# By: Garrett Holbrook
-# Date: August 27th, 2015
-#
-# Usage: Changes the system volume through amixer and then
-# makes a dbus method call to the gnome shell to get the
-# gnome volume OSD (On Screen Display)
-#
-# Requires: python3 and python-dbus (on Arch) or python3-dbus
-# (on Debian) or equivalent
-#
-# Git link: https://github.com/garrett92895/gnome-volume-step-osd
-import dbus
-import sys
-from subprocess import getoutput
-
-# Getting the dbus interface to communicate with gnome's OSD
-session_bus = dbus.SessionBus()
-proxy = session_bus.get_object('org.gnome.Shell', '/org/gnome/Shell')
-interface = dbus.Interface(proxy, 'org.gnome.Shell')
-
-# Interpreting how to affect the volume and by what percentage and
-# then creating a bash command that will reduce the stdout to the
-# new percentage volume. Vol = volume
-vol_action = sys.argv[1]
-vol_percent_change = sys.argv[2]
-
-command = 'amixer -D pulse sset Master ' + vol_percent_change + '%'
-
-if vol_action == 'increase':
- command += '+ > /dev/null && amixer -D pulse set Master unmute'
-else:
- command += '-'
-
-command += ' | grep -oP "\[\d*%\]" | head -n 1 | sed s:[][%]::g'
-
-current_vol_percentage = int(getoutput(command))
-# If it's 0 then add mute flag (tigger sub-action, keyboard ligth for example)
-if current_vol_percentage == 0:
- getoutput('amixer -D pulse set Master mute');
-
-# Determining which logo to use based off of the percentage
-logo = 'audio-volume-'
-if current_vol_percentage == 0:
- logo += 'muted'
-elif current_vol_percentage < 30:
- logo += 'low'
-elif current_vol_percentage < 70:
- logo += 'medium'
-else:
- logo += 'high'
-logo += '-symbolic'
-
-# Make the dbus method call
-interface.ShowOSD({"icon":logo, "level":current_vol_percentage})
-