forked from WayfireWM/wayfire
-
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.
Merge branch 'WayfireWM:master' into master
- Loading branch information
Showing
88 changed files
with
1,549 additions
and
504 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
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,54 @@ | ||
import wayfire_socket as ws | ||
import os | ||
import argparse | ||
import tabulate | ||
|
||
# Usage: | ||
# input.py list-inputs | ||
# input.py enable <id> | ||
# input.py disable <id> | ||
|
||
# argparse is used to parse the command line arguments | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument('action', choices=['list-inputs', 'enable', 'disable']) | ||
parser.add_argument('device', nargs='?', default=None) | ||
args = parser.parse_args() | ||
|
||
if args.action == 'list-inputs' and args.device is not None: | ||
print('Invalid usage, no arguments allowed when listing inputs!') | ||
exit(-1) | ||
|
||
if args.device is None and args.action != 'list-inputs': | ||
print('Invalid usage, an input id >= 0 is required!') | ||
exit(-1) | ||
|
||
addr = os.getenv('WAYFIRE_SOCKET') | ||
sock = ws.WayfireSocket(addr) | ||
|
||
devices = sock.list_input_devices() | ||
|
||
def find_device_id(name_or_id_or_type): | ||
for dev in devices: | ||
if dev['name'] == name_or_id_or_type or str(dev['id']) == name_or_id_or_type or dev['type'] == name_or_id_or_type: | ||
return dev['id'] | ||
return None | ||
|
||
if args.action == 'list-inputs': | ||
|
||
headers = ["Name", "ID", "Type", "Vendor/Product", "Enabled"] | ||
data = [] | ||
for dev in devices: | ||
data.append([ | ||
dev['name'], | ||
str(dev['id']), | ||
dev['type'], | ||
str(dev['vendor']) + ', ' + str(dev['product']), | ||
dev['enabled'] | ||
]) | ||
|
||
print(tabulate.tabulate(data, headers)) | ||
|
||
elif args.action == 'enable': | ||
print(sock.configure_input_device(find_device_id(args.device), True)) | ||
elif args.action == 'disable': | ||
print(sock.configure_input_device(find_device_id(args.device), False)) |
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
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
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
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
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
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
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,8 @@ | ||
<?xml version="1.0"?> | ||
<wayfire> | ||
<plugin name="input-method-v1"> | ||
<_short>Input-Method-V1 Protocol</_short> | ||
<_long>An implementation of the input-method-v1 protocol. Needed for proper functioning of input methods like Fcitx5.</_long> | ||
<category>Utility</category> | ||
</plugin> | ||
</wayfire> |
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
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.