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
| #!/bin/bash | |
| CURRENT_PROFILE=$(pactl list sinks | grep "Active Port" | cut -d ' ' -f 3-) | |
| NOTIFICATION_DURATION_MS=2000 | |
| notify() { | |
| notify-send --hint=int:transient:1 -t $NOTIFICATION_DURATION_MS "Sound Switch" "$1" | |
| } | |
| amixer -c0 set "Auto-Mute Mode" Disabled |
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
| const Applet = imports.ui.applet; | |
| const GLib = imports.gi.GLib; | |
| function run(cmd) { | |
| try { | |
| let [result, stdout, stderr] = GLib.spawn_command_line_sync(cmd); | |
| if (stdout !== null) { | |
| return stdout.toString(); | |
| } | |
| } catch (error) { |
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
| <schemalist> | |
| <schema id="com.benjuan26.soundswitch" path="/com/benjuan26/soundswitch/"> | |
| <key type="s" name="device"> | |
| <default>"analog-output-lineout"</default> | |
| <summary>The current audio output device</summary> | |
| <description/> | |
| </key> | |
| </schema> | |
| </schemalist> |
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
| const Applet = imports.ui.applet; | |
| const GLib = imports.gi.GLib; | |
| const Gio = imports.gi.Gio; | |
| const settingsSchemaId = 'com.benjuan26.soundswitch'; | |
| const settingsKey = 'device'; | |
| const notificationDuration = '2000'; | |
| const notificationTitle = 'Sound Switch'; | |
| function oppositeDevice(currentDevice) { |
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
| #!/bin/bash | |
| SCHEMA="com.benjuan26.soundswitch" | |
| KEY=device | |
| CURRENT_DEVICE=$(gsettings get ${SCHEMA} ${KEY}) | |
| if [ "$CURRENT_DEVICE" = "'analog-output-lineout'" ]; then | |
| echo "first one" | |
| gsettings set ${SCHEMA} ${KEY} "analog-output-headphones" | |
| else |
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
| #include <ArduinoJson.h> | |
| #include <Key.h> | |
| #include <Keypad.h> | |
| // Allow 5 seconds of lag from the device, to the game, and back to the device. | |
| #define BUTTON_SYNC_TIME 5000 | |
| // Each button press will last about 100ms. | |
| #define BUTTON_HOLD_TIME 100 |
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
| { | |
| "timestamp": "2017-12-07T10:31:37Z", | |
| "event": "Status", | |
| "Flags": 16842765, | |
| "Pips": [2,8,2], | |
| "FireGroup": 0, | |
| "Fuel": { | |
| "FuelMain": 15.146626, | |
| "FuelReservoir": 0.382796 | |
| }, |
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
| // Global variable to hold the flags from the game state. | |
| #define NO_FLAGS 0 | |
| unsigned long currentFlags = NO_FLAGS; | |
| // Each button press will last about 100ms. | |
| #define BUTTON_HOLD_TIME 100 | |
| struct Toggleswitch { | |
| byte currState; // State of the physical switch. | |
| byte lastState; // Last known state of the physical switch. |
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
| void serialRx() { | |
| if (!Serial.available()) { | |
| return; | |
| } | |
| DynamicJsonBuffer jsonBuffer(512); | |
| JsonObject &root = jsonBuffer.parseObject(Serial); | |
| if (!root.success()) { | |
| return; | |
| } |
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
| // Get the states of the physical switches and write them to the Toggleswitch objects. | |
| // Assuming for now that all global variables referenced here are declared and initialized. | |
| void updateKeys() { | |
| if (!kpd.getKeys()) { | |
| return; | |
| } | |
| for (int i = 0; i < LIST_MAX; i++) { | |
| if (kpd.key[i].kchar == NO_KEY) { | |
| continue; |
OlderNewer