-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d882389
Showing
11 changed files
with
441 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# editorconfig.org | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 4 | ||
end_of_line = crlf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.{md,rst,txt}] | ||
indent_size = 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
build | ||
.idea | ||
.vscode | ||
.history |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2018 <copyright holders> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<p align="center"> | ||
<img src="src/volumecontrol.ico" width="100" height="100" /> | ||
</p> | ||
|
||
# Keypirinha Plugin: volumecontrol | ||
|
||
This is **volumecontrol**, a plugin for the | ||
[Keypirinha](http://keypirinha.com) launcher. | ||
|
||
Increase, decrease, mute or unmute the volume on Windows using Keypirinha. | ||
|
||
## Examples usage | ||
|
||
### Set volume only using a number: | ||
![UsageNumber](usage_number.gif) | ||
|
||
### Complete usage: | ||
![UsageFull](usage_full.gif) | ||
|
||
## Download | ||
https://github.com/Fuhrmann/keypirinha-volumecontrol/releases/latest | ||
|
||
## Installation | ||
|
||
### With [PackageControl](https://github.com/ueffel/Keypirinha-PackageControl) | ||
|
||
Install Package "keypirinha-volumecontrol" | ||
|
||
### Manually | ||
|
||
* Download the `PHPDocSearch.keypirinha-package` from the [releases](https://github.com/Fuhrmann/keypirinha-phpdocsearch/releases/latest). | ||
* Copy the file into `%APPDATA%\Keypirinha\InstalledPackages` (installed mode) or | ||
`<Keypirinha_Home>\portable\Profile\InstalledPackages` (portable mode) | ||
|
||
## Usage | ||
|
||
Open Keypirinha and type 'vol'. See the gifs for usage. | ||
- Type `vol 15` or `vol55`: Sets the current volume level to the specified number. | ||
- mute or unmute: Mute or unmute. | ||
|
||
There are 3 predefined volume levels: low (25%), middle(50%) and high(75%). These are not configurable at this time. | ||
|
||
## License | ||
|
||
This package is distributed under the terms of the MIT license. | ||
|
||
# Credits | ||
This package was inpired on [alfred volume control](https://github.com/raulchen/alfred-volume-control). |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
@echo off | ||
setlocal | ||
|
||
set PACKAGE_NAME=VolumeControl | ||
set INSTALL_DIR=%APPDATA%\Keypirinha\InstalledPackages | ||
|
||
if "%1"=="" goto help | ||
if "%1"=="-h" goto help | ||
if "%1"=="--help" goto help | ||
if "%1"=="help" ( | ||
:help | ||
echo Usage: | ||
echo make help | ||
echo make clean | ||
echo make build | ||
echo make install | ||
echo make py [python_args] | ||
goto end | ||
) | ||
|
||
if "%BUILD_DIR%"=="" set BUILD_DIR=%~dp0build | ||
if "%KEYPIRINHA_SDK%"=="" ( | ||
echo ERROR: Keypirinha SDK environment not setup. | ||
echo Run SDK's "kpenv" script and try again. | ||
exit /b 1 | ||
) | ||
|
||
if "%1"=="clean" ( | ||
if exist "%BUILD_DIR%" rmdir /s /q "%BUILD_DIR%" | ||
goto end | ||
) | ||
|
||
if "%1"=="build" ( | ||
if not exist "%BUILD_DIR%" mkdir "%BUILD_DIR%" | ||
pushd "%~dp0" | ||
call "%KEYPIRINHA_SDK%\cmd\kparch" ^ | ||
"%BUILD_DIR%\%PACKAGE_NAME%.keypirinha-package" ^ | ||
-r LICENSE* README* src | ||
popd | ||
goto end | ||
) | ||
|
||
if "%1"=="install" ( | ||
echo TODO: ensure the INSTALL_DIR variable declared at the top of this | ||
echo script complies to your configuration and remove this message | ||
exit /1 | ||
|
||
copy /Y "%BUILD_DIR%\*.keypirinha-package" "%INSTALL_DIR%\" | ||
goto end | ||
) | ||
|
||
if "%1"=="py" ( | ||
call "%KEYPIRINHA_SDK%\cmd\kpy" %2 %3 %4 %5 %6 %7 %8 %9 | ||
goto end | ||
) | ||
|
||
:end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
[ | ||
{ | ||
"label": "Current volume {}%", | ||
"method": "get_current_volume", | ||
"description": "Shows the current volume", | ||
"target": "volume:set" | ||
}, | ||
{ | ||
"label": "{}", | ||
"method": "get_mute_text", | ||
"description": "Mute/unmute the volume", | ||
"target": "volume:set:0" | ||
}, | ||
{ | ||
"label": "Volume max", | ||
"description": "Set volume to max", | ||
"target": "volume:set:100" | ||
}, | ||
{ | ||
"label": "Low volume: 25%", | ||
"description": "Set the volume to 25%", | ||
"target": "volume:set:25" | ||
}, | ||
{ | ||
"label": "Middle volume: 50%", | ||
"description": "Set the volume to 50%", | ||
"target": "volume:set:50" | ||
}, | ||
{ | ||
"label": "High volume: 75%", | ||
"description": "Set the volume to 75%", | ||
"target": "volume:set:75" | ||
} | ||
] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
import ctypes | ||
from ctypes import wintypes | ||
import comtypes | ||
|
||
MMDeviceApiLib = comtypes.GUID('{2FDAAFA3-7523-4F66-9957-9D5E7FE698F6}') | ||
IID_IMMDevice = comtypes.GUID('{D666063F-1587-4E43-81F1-B948E807363F}') | ||
IID_IMMDeviceCollection = comtypes.GUID('{0BD7A1BE-7A1A-44DB-8397-CC5392387B5E}') | ||
IID_IMMDeviceEnumerator = comtypes.GUID('{A95664D2-9614-4F35-A746-DE8DB63617E6}') | ||
IID_IAudioEndpointVolume = comtypes.GUID('{5CDF2C82-841E-4546-9722-0CF74078229A}') | ||
CLSID_MMDeviceEnumerator = comtypes.GUID('{BCDE0395-E52F-467C-8E3D-C4579291692E}') | ||
|
||
# EDataFlow | ||
eRender = 0 # audio rendering stream | ||
eCapture = 1 # audio capture stream | ||
eAll = 2 # audio rendering or capture stream | ||
|
||
# ERole | ||
eConsole = 0 # games, system sounds, and voice commands | ||
eMultimedia = 1 # music, movies, narration | ||
eCommunications = 2 # voice communications | ||
|
||
LPCGUID = REFIID = ctypes.POINTER(comtypes.GUID) | ||
LPFLOAT = ctypes.POINTER(ctypes.c_float) | ||
LPDWORD = ctypes.POINTER(wintypes.DWORD) | ||
LPUINT = ctypes.POINTER(wintypes.UINT) | ||
LPBOOL = ctypes.POINTER(wintypes.BOOL) | ||
PIUnknown = ctypes.POINTER(comtypes.IUnknown) | ||
|
||
|
||
class IMMDevice(comtypes.IUnknown): | ||
_iid_ = IID_IMMDevice | ||
_methods_ = ( | ||
comtypes.COMMETHOD([], ctypes.HRESULT, 'Activate', | ||
(['in'], REFIID, 'iid'), | ||
(['in'], wintypes.DWORD, 'dwClsCtx'), | ||
(['in'], LPDWORD, 'pActivationParams', None), | ||
(['out', 'retval'], ctypes.POINTER(PIUnknown), 'ppInterface')), | ||
comtypes.STDMETHOD(ctypes.HRESULT, 'OpenPropertyStore', []), | ||
comtypes.COMMETHOD([], ctypes.HRESULT, 'GetId', | ||
(['out', 'retval'], ctypes.POINTER(wintypes.LPWSTR), 'ppstrId')), | ||
comtypes.STDMETHOD(ctypes.HRESULT, 'GetState', [])) | ||
|
||
|
||
PIMMDevice = ctypes.POINTER(IMMDevice) | ||
|
||
|
||
class IMMDeviceCollection(comtypes.IUnknown): | ||
_iid_ = IID_IMMDeviceCollection | ||
_methods_ = ( | ||
comtypes.COMMETHOD([], ctypes.HRESULT, | ||
'GetCount', | ||
(['out', 'retval'], ctypes.POINTER(wintypes.UINT), 'pcDevices')), | ||
comtypes.COMMETHOD([], ctypes.HRESULT, | ||
'Item', | ||
(['in'], wintypes.UINT, 'nDevice'), | ||
(['out', 'retval'], | ||
ctypes.POINTER(ctypes.POINTER(IMMDevice)), 'ppDevice')), | ||
) | ||
|
||
|
||
PIMMDeviceCollection = ctypes.POINTER(IMMDeviceCollection) | ||
|
||
class IMMDeviceEnumerator(comtypes.IUnknown): | ||
_iid_ = IID_IMMDeviceEnumerator | ||
_methods_ = ( | ||
comtypes.COMMETHOD([], ctypes.HRESULT, 'EnumAudioEndpoints', | ||
(['in'], wintypes.DWORD, 'dataFlow'), | ||
(['in'], wintypes.DWORD, 'dwStateMask'), | ||
(['out', 'retval'], ctypes.POINTER(PIMMDeviceCollection), | ||
'ppDevices')), | ||
comtypes.COMMETHOD([], ctypes.HRESULT, 'GetDefaultAudioEndpoint', | ||
(['in'], wintypes.DWORD, 'dataFlow'), | ||
(['in'], wintypes.DWORD, 'role'), | ||
(['out', 'retval'], ctypes.POINTER(PIMMDevice), 'ppDevices'))) | ||
|
||
@classmethod | ||
def get_default(cls, dataFlow, role): | ||
enumerator = comtypes.CoCreateInstance( | ||
CLSID_MMDeviceEnumerator, cls, comtypes.CLSCTX_INPROC_SERVER) | ||
return enumerator.GetDefaultAudioEndpoint(dataFlow, role) | ||
|
||
class IAudioEndpointVolume(comtypes.IUnknown): | ||
_iid_ = IID_IAudioEndpointVolume | ||
_methods_ = ( | ||
comtypes.STDMETHOD(ctypes.HRESULT, 'RegisterControlChangeNotify', []), | ||
comtypes.STDMETHOD(ctypes.HRESULT, 'UnregisterControlChangeNotify', []), | ||
comtypes.COMMETHOD([], ctypes.HRESULT, 'GetChannelCount', | ||
(['out', 'retval'], LPUINT, 'pnChannelCount')), | ||
comtypes.COMMETHOD([], ctypes.HRESULT, 'SetMasterVolumeLevel', | ||
(['in'], ctypes.c_float, 'fLevelDB'), | ||
(['in'], LPCGUID, 'pguidEventContext', None)), | ||
comtypes.COMMETHOD([], ctypes.HRESULT, 'SetMasterVolumeLevelScalar', | ||
(['in'], ctypes.c_float, 'fLevel'), | ||
(['in'], LPCGUID, 'pguidEventContext', None)), | ||
comtypes.COMMETHOD([], ctypes.HRESULT, 'GetMasterVolumeLevel', | ||
(['out', 'retval'], LPFLOAT, 'pfLevelDB')), | ||
comtypes.COMMETHOD([], ctypes.HRESULT, 'GetMasterVolumeLevelScalar', | ||
(['out', 'retval'], LPFLOAT, 'pfLevel')), | ||
comtypes.COMMETHOD([], ctypes.HRESULT, 'SetChannelVolumeLevel', | ||
(['in'], wintypes.UINT, 'nChannel'), | ||
(['in'], ctypes.c_float, 'fLevelDB'), | ||
(['in'], LPCGUID, 'pguidEventContext', None)), | ||
comtypes.COMMETHOD([], ctypes.HRESULT, 'SetChannelVolumeLevelScalar', | ||
(['in'], wintypes.UINT, 'nChannel'), | ||
(['in'], ctypes.c_float, 'fLevel'), | ||
(['in'], LPCGUID, 'pguidEventContext', None)), | ||
comtypes.COMMETHOD([], ctypes.HRESULT, 'GetChannelVolumeLevel', | ||
(['in'], wintypes.UINT, 'nChannel'), | ||
(['out', 'retval'], LPFLOAT, 'pfLevelDB')), | ||
comtypes.COMMETHOD([], ctypes.HRESULT, 'GetChannelVolumeLevelScalar', | ||
(['in'], wintypes.UINT, 'nChannel'), | ||
(['out', 'retval'], LPFLOAT, 'pfLevel')), | ||
comtypes.COMMETHOD([], ctypes.HRESULT, 'SetMute', | ||
(['in'], wintypes.BOOL, 'bMute'), | ||
(['in'], LPCGUID, 'pguidEventContext', None)), | ||
comtypes.COMMETHOD([], ctypes.HRESULT, 'GetMute', | ||
(['out', 'retval'], LPBOOL, 'pbMute')), | ||
comtypes.COMMETHOD([], ctypes.HRESULT, 'GetVolumeStepInfo', | ||
(['out', 'retval'], LPUINT, 'pnStep'), | ||
(['out', 'retval'], LPUINT, 'pnStepCount')), | ||
comtypes.COMMETHOD([], ctypes.HRESULT, 'VolumeStepUp', | ||
(['in'], LPCGUID, 'pguidEventContext', None)), | ||
comtypes.COMMETHOD([], ctypes.HRESULT, 'VolumeStepDown', | ||
(['in'], LPCGUID, 'pguidEventContext', None)), | ||
comtypes.COMMETHOD([], ctypes.HRESULT, 'QueryHardwareSupport', | ||
(['out', 'retval'], LPDWORD, 'pdwHardwareSupportMask')), | ||
comtypes.COMMETHOD([], ctypes.HRESULT, 'GetVolumeRange', | ||
(['out', 'retval'], LPFLOAT, 'pfLevelMinDB'), | ||
(['out', 'retval'], LPFLOAT, 'pfLevelMaxDB'), | ||
(['out', 'retval'], LPFLOAT, 'pfVolumeIncrementDB'))) | ||
|
||
@classmethod | ||
def get_default(cls): | ||
endpoint = IMMDeviceEnumerator.get_default(eRender, eMultimedia) | ||
interface = endpoint.Activate(cls._iid_, comtypes.CLSCTX_INPROC_SERVER) | ||
return ctypes.cast(interface, ctypes.POINTER(cls)) |
Binary file not shown.
Oops, something went wrong.