Merge remote-tracking branch 'origin/master' into develop
Resolved Conflicts:
    keyboards/kc60/rules.mk
    keyboards/xd96/rules.mk
    lib/python/qmk/cli/__init__.py
			
			
This commit is contained in:
		
						commit
						ac3b7d79e0
					
				
					 938 changed files with 35990 additions and 13003 deletions
				
			
		| 
						 | 
				
			
			@ -1,26 +1,32 @@
 | 
			
		|||
/* Copyright 2020 Jonathan Rascher
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 2 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/* Wait between tap_code register and unregister to fix flaky media keys. */
 | 
			
		||||
#undef TAP_CODE_DELAY
 | 
			
		||||
 | 
			
		||||
#define TAP_CODE_DELAY 20
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Force the default tapping term since some keyboards make it way too short
 | 
			
		||||
 * (*cough*Lily58*cough*).
 | 
			
		||||
 */
 | 
			
		||||
#undef TAPPING_TERM
 | 
			
		||||
 | 
			
		||||
#define TAPPING_TERM 200
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Treat mod-tap keys as holds even if the mod-tap key and the key being
 | 
			
		||||
 * modified are both relased within TAPPING_TERM. This assumes the mod-tap key
 | 
			
		||||
/* Treat mod-tap keys as holds even if the mod-tap key and the key being
 | 
			
		||||
 * modified are both released within TAPPING_TERM. This assumes the mod-tap key
 | 
			
		||||
 * isn't usually pressed in quick succession with other tapped keys, which is
 | 
			
		||||
 * good when the tap keycode is something like KC_ESC rather than a letter.
 | 
			
		||||
 */
 | 
			
		||||
#define PERMISSIVE_HOLD
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Turn off key repeat support of the tap keycode for tap-hold keys, enabling
 | 
			
		||||
/* Turn off key repeat support of the tap keycode for tap-hold keys, enabling
 | 
			
		||||
 * holds to work correctly in quick succession after taps.
 | 
			
		||||
 */
 | 
			
		||||
#define TAPPING_FORCE_HOLD
 | 
			
		||||
| 
						 | 
				
			
			@ -57,6 +63,9 @@
 | 
			
		|||
#    define RGBLIGHT_HUE_STEP 8
 | 
			
		||||
#    define RGBLIGHT_SAT_STEP 17
 | 
			
		||||
#    define RGBLIGHT_VAL_STEP 17
 | 
			
		||||
 | 
			
		||||
/* Turn on additional RGB animations. */
 | 
			
		||||
#    define RGBLIGHT_ANIMATIONS
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined(BACKLIGHT_ENABLE)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,13 +1,48 @@
 | 
			
		|||
# bcat's userspace
 | 
			
		||||
 | 
			
		||||
This is some code and config shared by all of [my](https://github.com/bcat)
 | 
			
		||||
keyboards. I have a few different keymaps spread throughout the repo; however,
 | 
			
		||||
they are all derived from two "canonical" keymaps for my preferred layouts:
 | 
			
		||||
keyboards. I use community layouts wherever possible, only writing
 | 
			
		||||
keyboard-specific keymaps for boards without standard layout support. I derive
 | 
			
		||||
my keymaps from two canonical ones (preferred for typing and gaming,
 | 
			
		||||
respectively).
 | 
			
		||||
 | 
			
		||||
* For typing, my canonical layout is my
 | 
			
		||||
[Crkbd](https://github.com/qmk/qmk_firmware/tree/master/keyboards/crkbd/keymaps/bcat)
 | 
			
		||||
(split ergo, columnar-staggered) layout.
 | 
			
		||||
## Canonical keymaps
 | 
			
		||||
 | 
			
		||||
* For gaming, my canonical layout is my
 | 
			
		||||
[Tsangan](https://github.com/qmk/qmk_firmware/tree/master/layouts/community/60_tsangan_hhkb/bcat)
 | 
			
		||||
(row-staggered) layout.
 | 
			
		||||
* [Split 3x6 + 3 thumb
 | 
			
		||||
keys](https://github.com/qmk/qmk_firmware/tree/master/layouts/community/split_3x6_3/bcat):
 | 
			
		||||
Columnar-staggered split ergo layout, preferred for typing. Used on Crkbd.
 | 
			
		||||
 | 
			
		||||
* [60% Tsangan
 | 
			
		||||
HHKB](https://github.com/qmk/qmk_firmware/tree/master/layouts/community/60_tsangan_hhkb/bcat):
 | 
			
		||||
Row-staggered layout, preferred for gaming. Used on ai03 Polaris, CannonKeys
 | 
			
		||||
AN-C, CannonKeys Instant60.
 | 
			
		||||
 | 
			
		||||
## Other keymaps
 | 
			
		||||
 | 
			
		||||
### Ergo
 | 
			
		||||
 | 
			
		||||
* [Lily58](https://github.com/qmk/qmk_firmware/tree/master/keyboards/lily58/keymaps/bcat)
 | 
			
		||||
 | 
			
		||||
### Ortho
 | 
			
		||||
 | 
			
		||||
* [Eco](https://github.com/qmk/qmk_firmware/tree/master/keyboards/eco/keymaps/bcat)
 | 
			
		||||
 | 
			
		||||
### Traditional
 | 
			
		||||
 | 
			
		||||
* [60% ANSI split
 | 
			
		||||
backspace/right-shift](https://github.com/qmk/qmk_firmware/tree/master/layouts/community/60_ansi_split_bs_rshift/bcat).
 | 
			
		||||
Used on DZ60.
 | 
			
		||||
 | 
			
		||||
* [65% ANSI blocker split
 | 
			
		||||
backspace](https://github.com/qmk/qmk_firmware/tree/master/layouts/community/65_ansi_blocker_split_bs/bcat).
 | 
			
		||||
Used on KBDfans KBD67 hotswap.
 | 
			
		||||
 | 
			
		||||
* [Keebio
 | 
			
		||||
Quefrency](https://github.com/qmk/qmk_firmware/tree/master/keyboards/keebio/quefrency/keymaps/bcat)
 | 
			
		||||
 | 
			
		||||
### Macropads
 | 
			
		||||
 | 
			
		||||
* [9-Key](https://github.com/qmk/qmk_firmware/tree/master/keyboards/9key/keymaps/bcat)
 | 
			
		||||
 | 
			
		||||
* [Keebio
 | 
			
		||||
BDN9](https://github.com/qmk/qmk_firmware/tree/master/keyboards/keebio/bdn9/keymaps/bcat)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										214
									
								
								users/brandonschlack/brandonschlack.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										214
									
								
								users/brandonschlack/brandonschlack.c
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,214 @@
 | 
			
		|||
/* Copyright 2020 Brandon Schlack
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 2 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
#include "brandonschlack.h"
 | 
			
		||||
 | 
			
		||||
user_config_t user_config;
 | 
			
		||||
#ifdef STOPLIGHT_LED
 | 
			
		||||
static stoplight_led_t stoplight_led;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Resets user config in EEPROM
 | 
			
		||||
 *
 | 
			
		||||
 * Default is use rgb for layer indication
 | 
			
		||||
 */
 | 
			
		||||
void eeconfig_init_user(void) {
 | 
			
		||||
    user_config.raw = 0;
 | 
			
		||||
    user_config.rgb_layer_change = true;
 | 
			
		||||
    user_config.rgb_theme = 0;
 | 
			
		||||
    eeconfig_update_user(user_config.raw);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__attribute__((weak))
 | 
			
		||||
void matrix_init_keymap(void){ }
 | 
			
		||||
 | 
			
		||||
void matrix_init_user(void) {
 | 
			
		||||
    matrix_init_keymap();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__attribute__((weak))
 | 
			
		||||
void keyboard_post_init_keymap(void){ }
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Reads user config from EEPROM,
 | 
			
		||||
 * calls RGB init if RGBs enabled
 | 
			
		||||
 */
 | 
			
		||||
void keyboard_post_init_user(void){
 | 
			
		||||
    // Read the user config from EEPROM
 | 
			
		||||
    user_config.raw = eeconfig_read_user();
 | 
			
		||||
    // Do Stoplight Animation if enabled
 | 
			
		||||
#ifdef STOPLIGHT_LED
 | 
			
		||||
    led_stoplight_start();
 | 
			
		||||
#endif
 | 
			
		||||
    // Do RGB things if RGBs enabled
 | 
			
		||||
#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
 | 
			
		||||
    keyboard_post_init_rgb();
 | 
			
		||||
#endif
 | 
			
		||||
    keyboard_post_init_keymap();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__attribute__ ((weak))
 | 
			
		||||
void shutdown_keymap(void) {}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * On shutdown,
 | 
			
		||||
 * If RGBs enabled,
 | 
			
		||||
 * then set RGB color to Red
 | 
			
		||||
 */
 | 
			
		||||
void shutdown_user (void) {
 | 
			
		||||
#ifdef RGBLIGHT_ENABLE
 | 
			
		||||
    rgblight_enable_noeeprom();
 | 
			
		||||
    rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
 | 
			
		||||
    rgblight_sethsv_noeeprom(0, 255, 127);
 | 
			
		||||
#endif // RGBLIGHT_ENABLE
 | 
			
		||||
#ifdef RGB_MATRIX_ENABLE
 | 
			
		||||
    rgb_matrix_set_color_all( 0xFF, 0x00, 0x00 );
 | 
			
		||||
#endif //RGB_MATRIX_ENABLE
 | 
			
		||||
    shutdown_keymap();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__attribute__ ((weak))
 | 
			
		||||
void suspend_power_down_keymap(void) {}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Set rgb_matrix suspend state to true if not already
 | 
			
		||||
 */
 | 
			
		||||
void suspend_power_down_user(void) {
 | 
			
		||||
#ifdef RGB_MATRIX_ENABLE
 | 
			
		||||
    if (!g_suspend_state) {
 | 
			
		||||
        rgb_matrix_set_suspend_state(true);
 | 
			
		||||
    }
 | 
			
		||||
#endif //RGB_MATRIX_ENABLE
 | 
			
		||||
    suspend_power_down_keymap();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__attribute__ ((weak))
 | 
			
		||||
void suspend_wakeup_init_keymap(void) {}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Set rgb_matrix suspend state to false if not already
 | 
			
		||||
 */
 | 
			
		||||
void suspend_wakeup_init_user(void) {
 | 
			
		||||
#ifdef RGB_MATRIX_ENABLE
 | 
			
		||||
    if (g_suspend_state) {
 | 
			
		||||
        rgb_matrix_set_suspend_state(false);
 | 
			
		||||
    }
 | 
			
		||||
#endif //RGB_MATRIX_ENABLE
 | 
			
		||||
    suspend_wakeup_init_keymap();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__attribute__ ((weak))
 | 
			
		||||
void matrix_scan_keymap(void) {}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Checks for Super CMD↯TAB
 | 
			
		||||
 */
 | 
			
		||||
void matrix_scan_user(void) {
 | 
			
		||||
    matrix_scan_cmd_tab();
 | 
			
		||||
#ifdef STOPLIGHT_LED
 | 
			
		||||
    matrix_scan_led_stoplight();
 | 
			
		||||
#endif
 | 
			
		||||
    matrix_scan_keymap();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__attribute__ ((weak))
 | 
			
		||||
layer_state_t default_layer_state_set_keymap(layer_state_t state) {
 | 
			
		||||
    return state;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * For macropads, if a new default layer is set from DF()
 | 
			
		||||
 * then automatically set that layer with layer_move()
 | 
			
		||||
 */
 | 
			
		||||
layer_state_t default_layer_state_set_user(layer_state_t state) {
 | 
			
		||||
#if defined(IS_MACROPAD)
 | 
			
		||||
    layer_move(get_highest_layer(state));
 | 
			
		||||
#endif
 | 
			
		||||
    return default_layer_state_set_keymap(state);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__attribute__ ((weak))
 | 
			
		||||
layer_state_t layer_state_set_keymap(layer_state_t state) {
 | 
			
		||||
    return state;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Do RGB things (like layer indication) on layer change
 | 
			
		||||
 */
 | 
			
		||||
layer_state_t layer_state_set_user(layer_state_t state) {
 | 
			
		||||
#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
 | 
			
		||||
    state = layer_state_set_rgb(state);
 | 
			
		||||
#endif // RGBLIGHT_ENABLE
 | 
			
		||||
    return layer_state_set_keymap(state);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__attribute__((weak)) bool led_update_keymap(led_t led_state) { return true; }
 | 
			
		||||
 | 
			
		||||
bool led_update_user(led_t led_state) {
 | 
			
		||||
#ifdef STOPLIGHT_LED
 | 
			
		||||
    if (stoplight_led.is_active) {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
#endif
 | 
			
		||||
    return led_update_keymap(led_state);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifdef STOPLIGHT_LED
 | 
			
		||||
void led_stoplight_start(void) {
 | 
			
		||||
    writePin(TOP_LED, LED_ON(false));
 | 
			
		||||
    writePin(MIDDLE_LED, LED_ON(false));
 | 
			
		||||
    writePin(BOTTOM_LED, LED_ON(false));
 | 
			
		||||
 | 
			
		||||
    stoplight_led.is_active = true;
 | 
			
		||||
    stoplight_led.timer = timer_read();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
void led_stoplight_set(pin_t pin) {
 | 
			
		||||
    writePin(pin, LED_ON(true));
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
void led_stoplight_end(void) {
 | 
			
		||||
    // Reset timer and status variables
 | 
			
		||||
    stoplight_led.is_active = false;
 | 
			
		||||
    stoplight_led.index = 0;
 | 
			
		||||
    stoplight_led.timer = 0;
 | 
			
		||||
    led_update_kb(host_keyboard_led_state());
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
void matrix_scan_led_stoplight(void) {
 | 
			
		||||
    if (stoplight_led.is_active) {
 | 
			
		||||
        if (timer_elapsed(stoplight_led.timer) > (1000 * (stoplight_led.index + 1))) {
 | 
			
		||||
            switch (stoplight_led.index){
 | 
			
		||||
                case 0:
 | 
			
		||||
                    led_stoplight_set(TOP_LED);
 | 
			
		||||
                    stoplight_led.index++;
 | 
			
		||||
                    break;
 | 
			
		||||
                case 1:
 | 
			
		||||
                    led_stoplight_set(MIDDLE_LED);
 | 
			
		||||
                    stoplight_led.index++;
 | 
			
		||||
                    break;
 | 
			
		||||
                case 2:
 | 
			
		||||
                    led_stoplight_set(BOTTOM_LED);
 | 
			
		||||
                    stoplight_led.index++;
 | 
			
		||||
                    break;
 | 
			
		||||
                default:
 | 
			
		||||
                    led_stoplight_end();
 | 
			
		||||
                    break;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
							
								
								
									
										83
									
								
								users/brandonschlack/brandonschlack.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										83
									
								
								users/brandonschlack/brandonschlack.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,83 @@
 | 
			
		|||
/* Copyright 2020 Brandon Schlack
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 2 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include "quantum.h"
 | 
			
		||||
#include "version.h"
 | 
			
		||||
#include "eeprom.h"
 | 
			
		||||
#include "process_records.h"
 | 
			
		||||
#ifdef TAP_DANCE_ENABLE
 | 
			
		||||
#   include "tap_dances.h"
 | 
			
		||||
#endif // TAP_DANCE_ENABLE
 | 
			
		||||
#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
 | 
			
		||||
#   include "rgb_bs.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/* TODO Layer Names */
 | 
			
		||||
enum bs_layers {
 | 
			
		||||
    _BASE = 0,
 | 
			
		||||
    _M1 = 1,
 | 
			
		||||
    _M2 = 2,
 | 
			
		||||
    _M3 = 3,
 | 
			
		||||
    _M4 = 4,
 | 
			
		||||
    _FN1 = 5,
 | 
			
		||||
    _M1_FN1 = 6,
 | 
			
		||||
    _M2_FN1 = 7,
 | 
			
		||||
    _M3_FN1 = 8,
 | 
			
		||||
    _M4_FN1 = 9,
 | 
			
		||||
    _FN2 = 10,
 | 
			
		||||
    _M1_FN2 = 11,
 | 
			
		||||
    _M2_FN2 = 12,
 | 
			
		||||
    _M3_FN2 = 13,
 | 
			
		||||
    _M4_FN2 = 14,
 | 
			
		||||
    _ADJUST = 15 // 15: Change keyboard settings
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#define _LOWER _FN1
 | 
			
		||||
#define _RAISE _FN2
 | 
			
		||||
 | 
			
		||||
/* TODO User EECONFIG */
 | 
			
		||||
typedef union {
 | 
			
		||||
  uint32_t raw;
 | 
			
		||||
  struct {
 | 
			
		||||
    bool     rgb_layer_change :1;
 | 
			
		||||
    uint8_t  rgb_theme :4;
 | 
			
		||||
  };
 | 
			
		||||
} user_config_t;
 | 
			
		||||
extern user_config_t user_config;
 | 
			
		||||
 | 
			
		||||
void matrix_init_keymap(void);
 | 
			
		||||
void keyboard_post_init_keymap(void);
 | 
			
		||||
void shutdown_keymap(void);
 | 
			
		||||
void suspend_power_down_keymap(void);
 | 
			
		||||
void suspend_wakeup_init_keymap(void);
 | 
			
		||||
void matrix_scan_keymap(void);
 | 
			
		||||
layer_state_t default_layer_state_set_keymap(layer_state_t state);
 | 
			
		||||
layer_state_t layer_state_set_keymap(layer_state_t state);
 | 
			
		||||
bool led_update_keymap(led_t led_state);
 | 
			
		||||
 | 
			
		||||
#ifdef STOPLIGHT_LED
 | 
			
		||||
typedef struct {
 | 
			
		||||
    bool     is_active :1;
 | 
			
		||||
    uint8_t  index     :7;
 | 
			
		||||
    uint16_t timer     :16;
 | 
			
		||||
} stoplight_led_t;
 | 
			
		||||
 | 
			
		||||
void led_stoplight_start(void);
 | 
			
		||||
void led_stoplight_set(pin_t pin);
 | 
			
		||||
void led_stoplight_end(void);
 | 
			
		||||
void matrix_scan_led_stoplight(void);
 | 
			
		||||
#endif
 | 
			
		||||
							
								
								
									
										55
									
								
								users/brandonschlack/config.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								users/brandonschlack/config.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,55 @@
 | 
			
		|||
/* Copyright 2020 Brandon Schlack
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 2 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#define TAPPING_TOGGLE 2
 | 
			
		||||
#define TAPPING_TERM 200
 | 
			
		||||
#define PERMISSIVE_HOLD
 | 
			
		||||
#define TAP_HOLD_CAPS_DELAY 200
 | 
			
		||||
 | 
			
		||||
#ifdef RGBLIGHT_ENABLE
 | 
			
		||||
#   define RGBLIGHT_SLEEP
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) && !defined(RGBLIGHT_LAYERS)
 | 
			
		||||
#   define RGB_THEME_ENABLE
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef RGB_THEME_ENABLE
 | 
			
		||||
#   define DISABLE_RGB_THEME_JAMON
 | 
			
		||||
#   define DISABLE_RGB_THEME_OBLIQUE
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef ENCODER_ENABLE
 | 
			
		||||
#    define TAP_CODE_DELAY 10
 | 
			
		||||
#else
 | 
			
		||||
#    define TAP_CODE_DELAY 5
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/* Disable unused and unneeded features to reduce on firmware size */
 | 
			
		||||
#ifndef NO_ACTION_MACRO
 | 
			
		||||
#   define NO_ACTION_MACRO
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef NO_ACTION_FUNCTION
 | 
			
		||||
#   define NO_ACTION_FUNCTION
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef LOCKING_SUPPORT_ENABLE
 | 
			
		||||
#    undef LOCKING_SUPPORT_ENABLE
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef LOCKING_RESYNC_ENABLE
 | 
			
		||||
#    undef LOCKING_RESYNC_ENABLE
 | 
			
		||||
#endif
 | 
			
		||||
							
								
								
									
										172
									
								
								users/brandonschlack/process_records.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										172
									
								
								users/brandonschlack/process_records.c
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,172 @@
 | 
			
		|||
/* Copyright 2020 Brandon Schlack
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 2 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
#include "brandonschlack.h"
 | 
			
		||||
 | 
			
		||||
// Super CMD↯TAB
 | 
			
		||||
bool is_cmd_tab_active = false;
 | 
			
		||||
uint16_t cmd_tab_timer = 0;
 | 
			
		||||
 | 
			
		||||
__attribute__ ((weak))
 | 
			
		||||
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Consolidated Macros
 | 
			
		||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
 | 
			
		||||
    switch (keycode) {
 | 
			
		||||
        case QM_MAKE: // Sends 'qmk compile' or 'qmk flash'
 | 
			
		||||
            if (record->event.pressed) {
 | 
			
		||||
                bool flash = false;
 | 
			
		||||
        // If is a keyboard and auto-flash is not set in rules.mk,
 | 
			
		||||
        // then Shift will trigger the flash command
 | 
			
		||||
        #if !defined(FLASH_BOOTLOADER) && !defined(IS_MACROPAD)
 | 
			
		||||
                uint8_t temp_mod = get_mods();
 | 
			
		||||
                uint8_t temp_osm = get_oneshot_mods();
 | 
			
		||||
                clear_mods();
 | 
			
		||||
                clear_oneshot_mods();
 | 
			
		||||
                if ( (temp_mod | temp_osm) & MOD_MASK_SHIFT )
 | 
			
		||||
        #endif
 | 
			
		||||
                {
 | 
			
		||||
                    flash = true;
 | 
			
		||||
                }
 | 
			
		||||
                send_make_command(flash);
 | 
			
		||||
            }
 | 
			
		||||
            break;
 | 
			
		||||
        case QM_FLSH: // Sends flash command instead of compile
 | 
			
		||||
            if (record->event.pressed) {
 | 
			
		||||
                clear_mods();
 | 
			
		||||
                clear_oneshot_mods();
 | 
			
		||||
                send_make_command(true);
 | 
			
		||||
            }
 | 
			
		||||
            break;
 | 
			
		||||
        case QM_VRSN:  // Prints firmware version
 | 
			
		||||
            if (record->event.pressed) {
 | 
			
		||||
                SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE);
 | 
			
		||||
            }
 | 
			
		||||
            break;
 | 
			
		||||
        case QM_KYBD:  // Prints keyboard path
 | 
			
		||||
            if (record->event.pressed) {
 | 
			
		||||
                SEND_STRING("keyboards/" QMK_KEYBOARD "/");
 | 
			
		||||
            }
 | 
			
		||||
            break;
 | 
			
		||||
        case QM_KYMP:  // Prints keymap path
 | 
			
		||||
            if (record->event.pressed) {
 | 
			
		||||
                SEND_STRING("keyboards/" QMK_KEYBOARD "/keymaps/" QMK_KEYMAP "/keymap.c");
 | 
			
		||||
            }
 | 
			
		||||
            break;
 | 
			
		||||
        case CMD_TAB: // Super CMD↯TAB
 | 
			
		||||
            if (record->event.pressed) {
 | 
			
		||||
                if (!is_cmd_tab_active) {
 | 
			
		||||
                    is_cmd_tab_active = true;
 | 
			
		||||
                    register_code(KC_LGUI);
 | 
			
		||||
                }
 | 
			
		||||
                cmd_tab_timer = timer_read();
 | 
			
		||||
                register_code(KC_TAB);
 | 
			
		||||
            } else {
 | 
			
		||||
                unregister_code(KC_TAB);
 | 
			
		||||
            }
 | 
			
		||||
            break;
 | 
			
		||||
        #if defined(RGB_THEME_ENABLE)
 | 
			
		||||
        case RGB_LYR:
 | 
			
		||||
            if (record->event.pressed) {
 | 
			
		||||
                user_config.rgb_layer_change ^= 1;
 | 
			
		||||
                dprintf("rgb layer change [EEPROM]: %u\n", user_config.rgb_layer_change);
 | 
			
		||||
                eeconfig_update_user(user_config.raw);
 | 
			
		||||
                if (user_config.rgb_layer_change) {
 | 
			
		||||
                    layer_state_set(layer_state);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            break;
 | 
			
		||||
        case RGB_HUI ... RGB_SAD:
 | 
			
		||||
            if (record->event.pressed) {
 | 
			
		||||
                if (user_config.rgb_layer_change) {
 | 
			
		||||
                    user_config.rgb_layer_change = false;
 | 
			
		||||
                    dprintf("rgb layer change [EEPROM]: %u\n", user_config.rgb_layer_change);
 | 
			
		||||
                    eeconfig_update_user(user_config.raw);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            break;
 | 
			
		||||
        case RGB_THEME_FORWARD:
 | 
			
		||||
            if (record->event.pressed) {
 | 
			
		||||
                uint8_t shifted = get_mods() & (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT));
 | 
			
		||||
                if(shifted) {
 | 
			
		||||
                    rgb_theme_step_reverse();
 | 
			
		||||
                } else {
 | 
			
		||||
                    rgb_theme_step();
 | 
			
		||||
                }
 | 
			
		||||
                layer_state_set(layer_state);
 | 
			
		||||
            }
 | 
			
		||||
            break;
 | 
			
		||||
        case RGB_THEME_REVERSE:
 | 
			
		||||
            if (record->event.pressed) {
 | 
			
		||||
                uint8_t shifted = get_mods() & (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT));
 | 
			
		||||
                if(shifted) {
 | 
			
		||||
                    rgb_theme_step();
 | 
			
		||||
                } else {
 | 
			
		||||
                    rgb_theme_step_reverse();
 | 
			
		||||
                }
 | 
			
		||||
                layer_state_set(layer_state);
 | 
			
		||||
            }
 | 
			
		||||
            break;
 | 
			
		||||
        #endif
 | 
			
		||||
    }
 | 
			
		||||
    return process_record_keymap(keycode, record);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Super CMD↯TAB
 | 
			
		||||
void matrix_scan_cmd_tab(void) {
 | 
			
		||||
    if (is_cmd_tab_active) {
 | 
			
		||||
        if (timer_elapsed(cmd_tab_timer) > 500) {
 | 
			
		||||
            unregister_code(KC_LGUI);
 | 
			
		||||
            is_cmd_tab_active = false;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Send Make Command
 | 
			
		||||
 *
 | 
			
		||||
 * Sends 'qmk compile -kb keyboard -km keymap' command to compile firmware
 | 
			
		||||
 * Uses 'qmk flash' and resets keyboard, if flash_bootloader set to true
 | 
			
		||||
 * Sends CTPC and/or FORCE_LAYOUT parameters if built with those options
 | 
			
		||||
 */
 | 
			
		||||
void send_make_command(bool flash_bootloader) {
 | 
			
		||||
#ifdef FORCE_LAYOUT // Add layout string if built with FORCE_LAYOUT
 | 
			
		||||
    SEND_STRING("FORCE_LAYOUT=" FORCE_LAYOUT " ");
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef CONVERT_TO_PROTON_C // Add CTPC if built with CONVERT_TO_PROTON_C
 | 
			
		||||
    SEND_STRING("CTPC=yes ");
 | 
			
		||||
#endif
 | 
			
		||||
    SEND_STRING("qmk ");
 | 
			
		||||
    if (flash_bootloader) {
 | 
			
		||||
#ifndef KEYBOARD_massdrop // Don't run flash for Massdrop boards
 | 
			
		||||
        SEND_STRING("flash ");
 | 
			
		||||
    } else {
 | 
			
		||||
#endif
 | 
			
		||||
        SEND_STRING("compile ");
 | 
			
		||||
    }
 | 
			
		||||
    SEND_STRING("-kb " QMK_KEYBOARD " ");
 | 
			
		||||
    SEND_STRING("-km " QMK_KEYMAP);
 | 
			
		||||
    if (flash_bootloader) {
 | 
			
		||||
#if defined(KEYBOARD_massdrop) // only run for Massdrop boards
 | 
			
		||||
        SEND_STRING(" && mdlflash " QMK_KEYBOARD " " QMK_KEYMAP);
 | 
			
		||||
#endif
 | 
			
		||||
    }
 | 
			
		||||
    SEND_STRING(SS_TAP(X_ENTER));
 | 
			
		||||
    if (flash_bootloader) {
 | 
			
		||||
        reset_keyboard();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										152
									
								
								users/brandonschlack/process_records.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										152
									
								
								users/brandonschlack/process_records.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,152 @@
 | 
			
		|||
/* Copyright 2020 Brandon Schlack
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 2 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
#pragma once
 | 
			
		||||
#include "brandonschlack.h"
 | 
			
		||||
 | 
			
		||||
// Macros
 | 
			
		||||
enum custom_keycodes {
 | 
			
		||||
    QM_MAKE = SAFE_RANGE,
 | 
			
		||||
    QM_FLSH,
 | 
			
		||||
    QM_VRSN,
 | 
			
		||||
    QM_KYBD,
 | 
			
		||||
    QM_KYMP,
 | 
			
		||||
    CMD_TAB,
 | 
			
		||||
    RGB_LYR,
 | 
			
		||||
    RGB_THEME_FORWARD,
 | 
			
		||||
    RGB_THEME_REVERSE,
 | 
			
		||||
    KEYMAP_SAFE_RANGE
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
bool process_record_keymap(uint16_t keycode, keyrecord_t *record);
 | 
			
		||||
void matrix_scan_cmd_tab(void);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * QMK Defines
 | 
			
		||||
 * Some meta aliases for QMK features such as Mod-Taps
 | 
			
		||||
 * and for cleaner looking Layer Toggles
 | 
			
		||||
 */
 | 
			
		||||
/* Control Mod-Tap */
 | 
			
		||||
#define CTL_ESC    CTL_T(KC_ESC)       // Hold Escape for Control
 | 
			
		||||
#define CTL_TAB    CTL_T(KC_TAB)       // Hold Tab for Control
 | 
			
		||||
#define CTL_CAP    CTL_T(KC_CAPS)      // Hold Caps Lock for Control
 | 
			
		||||
/* Command Mod-Tap */
 | 
			
		||||
#define CMD_ESC    CMD_T(KC_ESC)       // Hold Escape for Command
 | 
			
		||||
#define CMD_CAP    CMD_T(KC_CAPS)      // Hold Caps Lock for Command
 | 
			
		||||
#define CMD_SPC    CMD_T(KC_SPC)       // Hold Space for Command
 | 
			
		||||
/* Hyper Mod-Tap */
 | 
			
		||||
#define HY_ESC    ALL_T(KC_ESC)        // Hold Escape for Hyper (Shift-Control-Option-Command)
 | 
			
		||||
#define HY_TAB    ALL_T(KC_TAB)        // Hold Tab for Hyper (Shift-Control-Option-Command)
 | 
			
		||||
#define HY_CAPS   ALL_T(KC_CAPS)       // Hold Caps Lock for Hyper (Shift-Control-Option-Command)
 | 
			
		||||
/* Shift Mod-Tap */
 | 
			
		||||
#define SF_CAPS   LSFT_T(KC_CAPS)      // Hold Caps Lock for Left Shift
 | 
			
		||||
#define SFT_ENT   RSFT_T(KC_ENT)       // Hold Enter for Right Shift
 | 
			
		||||
#define SF_SLSH   RSFT_T(KC_SLSH)      // Tap Right Shift for Slash (/)
 | 
			
		||||
#define SF_BSLS   RSFT_T(KC_BSLS)      // Tap Right Shift for Back Slash (\)
 | 
			
		||||
/* Layer Aliases */
 | 
			
		||||
#define FN_LYR    MO(_FN1)             // Hold for FN Layer
 | 
			
		||||
#define FN2_LYR   MO(_FN2)             // Hold for FN2 Layer
 | 
			
		||||
#define LOWER     MO(_LOWER)           // Hold for LOWER Layer
 | 
			
		||||
#define RAISE     MO(_RAISE)           // Hold for RAISE Layer
 | 
			
		||||
#define TT_FN     TT(_FN1)             // Hold for FN Layer, or Double-Tap to Toggle
 | 
			
		||||
#define TT_FN2    TT(_FN2)             // Hold for FN2 Layer, or Double-Tap to Toggle
 | 
			
		||||
#define TT_LWR    TT(_LOWER)           // Hold for LOWER Layer, or Double-Tap to Toggle
 | 
			
		||||
#define TT_RAI    TT(_RAISE)           // Hold for RAISE Layer, or Double-Tap to Toggle
 | 
			
		||||
#define SPC_LWR   LT(_LOWER, KC_SPC)   // Tap for Space, Hold for LOWER Layer
 | 
			
		||||
#define SPC_RAI   LT(_RAISE, KC_SPC)   // Tap for Space, Hold for RAISE Layer
 | 
			
		||||
#define SLH_LWR   LT(_LOWER, KC_SLSH)  // Tap for /, Hold for LOWER Layer
 | 
			
		||||
#define BSL_LWR   LT(_LOWER, KC_BSLS)  // Tap for \, Hold for LOWER Layer
 | 
			
		||||
#define MCO_LYR   MO(_MACRO)           // Hold for MACRO Layer
 | 
			
		||||
#define TG_ADJT   TG(_ADJUST)          // Toggle ADJUST Layer
 | 
			
		||||
#define TG_LGHT   TG(_LIGHT)           // Toggle LIGHT Layer
 | 
			
		||||
/**
 | 
			
		||||
 * Media Mod-Tap
 | 
			
		||||
 * Use the Mod-Tap feature for easy media controls
 | 
			
		||||
 * Used with >=65% layouts
 | 
			
		||||
 */
 | 
			
		||||
#define RWD_CMD   RCMD_T(KC_MPRV)      // Tap Right Command for Prev Track
 | 
			
		||||
#define PLY_CMD   RCMD_T(KC_MPLY)      // Tap Right Command for Play/Pause
 | 
			
		||||
#define FFD_OPT   ROPT_T(KC_MNXT)      // Tap Right Option for Next Track
 | 
			
		||||
#define PLY_FN1   LT(_FN1, KC_MPLY)    // Tap Fn for Play/Pause
 | 
			
		||||
#define PLY_FN2   LT(_FN2, KC_MPLY)    // Tap Fn2 for Play/Pause
 | 
			
		||||
#define MUT_SFT   RSFT_T(KC_MUTE)      // Tap Right Shift for Mute
 | 
			
		||||
/**
 | 
			
		||||
 * Arrow Mod-Tap
 | 
			
		||||
 * Use the Mod-Tap feature for arrow keys
 | 
			
		||||
 * Mostly used for 40-60% layouts
 | 
			
		||||
 */
 | 
			
		||||
#define UP_RSFT   RSFT_T(KC_UP)        // Tap Right Shift for Up
 | 
			
		||||
#define LFT_OPT   ROPT_T(KC_LEFT)      // Tap Right Option for Left
 | 
			
		||||
#define LFT_CMD   RCMD_T(KC_LEFT)      // Tap Right Command for Left
 | 
			
		||||
#define DWN_FN1   LT(1, KC_DOWN)       // Tap Fn for Down
 | 
			
		||||
#define DWN_LWR   DWN_FN1              // Tap Lower for Down
 | 
			
		||||
#define DWN_FN2   LT(2, KC_DOWN)       // Tap Fn2 for Down
 | 
			
		||||
#define DWN_RAI   DWN_FN2              // Tap Raise for Down
 | 
			
		||||
#define DWN_OPT   ROPT_T(KC_DOWN)      // Tap Right Option for Down
 | 
			
		||||
#define RGT_SFT   RSFT_T(KC_RGHT)      // Tap Right Shift for Right
 | 
			
		||||
#define RGT_OPT   ROPT_T(KC_RGHT)      // Tap Right Option for Right
 | 
			
		||||
#define RGT_CTL   RCTL_T(KC_RGHT)      // Tap Right Ctrl for Right
 | 
			
		||||
/**
 | 
			
		||||
 * Nav Mod-Tap
 | 
			
		||||
 * Use the Mod-Tap feature for nav keys (Home/End, Page Up/Down)
 | 
			
		||||
 * Mostly used for 40-60% layouts, on a function layer
 | 
			
		||||
 */
 | 
			
		||||
#define PGU_SFT   RSFT_T(KC_PGUP)      // Tap Right Shift for Page Up
 | 
			
		||||
#define HOM_OPT   ROPT_T(KC_HOME)      // Tap Right Option for Home
 | 
			
		||||
#define HOM_CMD   RCMD_T(KC_HOME)      // Tap Right Command for Home
 | 
			
		||||
#define PGD_OPT   ROPT_T(KC_PGDN)      // Tap Right Option for Page Down
 | 
			
		||||
#define PGD_FN1   LT(1, KC_PGDN)       // Tap Fn for Page Down
 | 
			
		||||
#define PGD_LWR   PGD_FN1              // Tap Lower for Page Down
 | 
			
		||||
#define PGD_FN2   LT(2, KC_PGDN)       // Tap Fn2 for Page Down
 | 
			
		||||
#define PGD_RAI   PGD_FN2              // Tap Raise for Page Down
 | 
			
		||||
#define END_OPT   ROPT_T(KC_END)       // Tap Right Option for End
 | 
			
		||||
#define END_CTL   RCTL_T(KC_END)       // Tap Right Control for End
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * MacOS
 | 
			
		||||
 * Common shortcuts used in macOS
 | 
			
		||||
 * Reference: https://support.apple.com/en-us/HT201236
 | 
			
		||||
 */
 | 
			
		||||
#define MC_POWR   KC_POWER             // Power (KC_POWER)
 | 
			
		||||
#define MC_SLEP   LOPT(LCMD(KC_POWER)) // Sleep (Option-Command-Power)
 | 
			
		||||
#define MC_SLPD   LCTL(LSFT(KC_POWER)) // Sleep Display (Control-Shift-Power)
 | 
			
		||||
#define MC_LOCK   LCTL(LCMD(KC_Q))     // Lock Screen (Control-Command-Q)
 | 
			
		||||
#define MC_MSSN   KC_FIND              // Mission Control: Configure karabiner for find -> mission_control
 | 
			
		||||
#define MC_LHPD   KC_MENU              // Launchpad: Configure karabiner for menu -> launchpad
 | 
			
		||||
#define MC_CMTB   LCMD(KC_TAB)         // Command-Tab
 | 
			
		||||
#define MC_BACK   LCMD(KC_LBRC)        // Back (Command–Left Bracket)
 | 
			
		||||
#define MC_FWRD   LCMD(KC_RBRC)        // Forward (Command–Right Bracket)
 | 
			
		||||
#define CLS_TAB   LCMD(KC_W)           // Close Tab (Command–W)
 | 
			
		||||
#define REO_TAB   LSFT(LCMD(KC_T))     // Reopen Last Tab (Shift-Command-T)
 | 
			
		||||
#define NXT_TAB   LCTL(KC_TAB)         // Next Tab (Control-Tab)
 | 
			
		||||
#define PRV_TAB   LSFT(LCTL(KC_TAB))   // Previous Tab (Shift-Control-Tab)
 | 
			
		||||
#define NXT_WIN   LCMD(KC_GRV)         // Next Window (Control-Grave)
 | 
			
		||||
#define PRV_WIN   LCMD(KC_TILD)        // Previous Window (Shift-Control-Grave)
 | 
			
		||||
#define MC_PLYR   LCMD(KC_F8)          // Focuses current Media Player
 | 
			
		||||
#define MC_UNDO   LCMD(KC_Z)           // Undo (Command-Z)
 | 
			
		||||
#define MC_REDO   LSFT(LCMD(KC_Z))     // Redo (Shift-Command-Z)
 | 
			
		||||
#define OP_AFLL   HYPR(KC_BSLS)        // 1Password Autofill (Shift-Control-Option-Command-\)
 | 
			
		||||
#define PX_AFLL   LSFT(LOPT(KC_X))     // 1PasswordX Autofill (Shift-Option-X)
 | 
			
		||||
// Reverse scrolling for using with macOS Natural Scrolling.
 | 
			
		||||
#define MC_WH_U   KC_WH_D              // Mouse Wheel Up
 | 
			
		||||
#define MC_WH_D   KC_WH_U              // Mouse Wheel Down
 | 
			
		||||
#define MC_WH_L   KC_WH_R              // Mouse Wheel Left
 | 
			
		||||
#define MC_WH_R   KC_WH_L              // Mouse Wheel Right
 | 
			
		||||
 | 
			
		||||
// RGB Theme
 | 
			
		||||
#define RGB_THM   RGB_THEME_FORWARD    // Cycle next RGB_THEME
 | 
			
		||||
#define RGB_RTHM  RGB_THEME_REVERSE    // Cycle previous RGB_THEME
 | 
			
		||||
 | 
			
		||||
void send_make_command(bool flash_bootloader);
 | 
			
		||||
							
								
								
									
										48
									
								
								users/brandonschlack/readme.md
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								users/brandonschlack/readme.md
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,48 @@
 | 
			
		|||
# Overview
 | 
			
		||||
 | 
			
		||||
My QMK home. I feel as though I stand on the shoulders of giants, for a lot of my code here is borrowed and adapted from so many contributors here, and that I hope my code here can help or inspire others.
 | 
			
		||||
 | 
			
		||||
## Layers, Handlers, and Macros
 | 
			
		||||
### Layers
 | 
			
		||||
 | 
			
		||||
I have some predefined layer names for keyboards:
 | 
			
		||||
* **_BASE**: Default Layer, QWERTY layout.
 | 
			
		||||
* **_FN1**: Function Layer for 60% and above, and additional macros and shortcuts on 50% and below. 
 | 
			
		||||
* **_LOWER** and **_RAISE**: Function layers for 40%
 | 
			
		||||
 | 
			
		||||
and macropads:
 | 
			
		||||
* **_REEDER**: Shortcuts for [Reeder.app](https://reederapp.com/), my RSS feed reader
 | 
			
		||||
* **_MEDIA**: Media controls
 | 
			
		||||
* **_NAVI**: Navigation macros, for changing tabs and scrolling
 | 
			
		||||
* **_KARABINER**: Generic macro keys, meant to be customized per app with [Karabiner](https://pqrs.org/osx/karabiner/)
 | 
			
		||||
 | 
			
		||||
#### Protected Layers
 | 
			
		||||
I have some named "protected" layers, meant to be at the end of the layer list for changing keyboard settings and features.
 | 
			
		||||
 | 
			
		||||
* **KEYMAP_LAYERS**: Add additional layers in keymap.
 | 
			
		||||
* **_AUDIO**: Audio feature controls.
 | 
			
		||||
* **_LIGHT**: RGB Light/Matrix feature controls.
 | 
			
		||||
* **_ADJUST**: General keyboard settings and toggles. Can also contain RGB and Audio controls on larger boards that don't need and extra layer for those controls.
 | 
			
		||||
 | 
			
		||||
### EEPROM User Config
 | 
			
		||||
 | 
			
		||||
I have a custom userspace config implemented to save settings on the board to persist across shutdowns. I currently store:
 | 
			
		||||
 | 
			
		||||
* rgb_layer_change - a toggle for using RGB themes for layer indication
 | 
			
		||||
* rgb_theme - a pointer to the currently set RGB Theme
 | 
			
		||||
 | 
			
		||||
### Process Handlers
 | 
			
		||||
 | 
			
		||||
### Keycode Aliases
 | 
			
		||||
 | 
			
		||||
I am a macOS user and so a lot of my aliases are 
 | 
			
		||||
 | 
			
		||||
### Macros
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## Tap Dances
 | 
			
		||||
 | 
			
		||||
### Tap Dance Trigger Layer
 | 
			
		||||
 | 
			
		||||
## RGB
 | 
			
		||||
### RGB Theme
 | 
			
		||||
							
								
								
									
										146
									
								
								users/brandonschlack/rgb_bs.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										146
									
								
								users/brandonschlack/rgb_bs.c
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,146 @@
 | 
			
		|||
/* Copyright 2020 Brandon Schlack
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 2 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
#include "brandonschlack.h"
 | 
			
		||||
#include "rgb_theme.h"
 | 
			
		||||
#include "rgb_bs.h"
 | 
			
		||||
 | 
			
		||||
#if defined(RGBLIGHT_ENABLE)
 | 
			
		||||
extern rgblight_config_t rgblight_config;
 | 
			
		||||
#elif defined(RGB_MATRIX_ENABLE)
 | 
			
		||||
extern rgb_config_t rgb_matrix_config;
 | 
			
		||||
extern bool g_suspend_state;
 | 
			
		||||
extern led_config_t g_led_config;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined(RGB_THEME_ENABLE)
 | 
			
		||||
// Should be rgb_theme.c
 | 
			
		||||
#define RGB_THEME(name) const rgb_theme_t RGB_##name
 | 
			
		||||
#define RGB_THEME_IMPLS
 | 
			
		||||
#include "rgb_theme_user.inc"
 | 
			
		||||
#undef RGB_THEME_IMPLS
 | 
			
		||||
#undef RGB_THEME
 | 
			
		||||
 | 
			
		||||
#define RGB_THEME(name) [RGB_THEME_##name] = &RGB_##name,
 | 
			
		||||
const rgb_theme_t *themes[] = {
 | 
			
		||||
    #include "rgb_theme_user.inc"
 | 
			
		||||
};
 | 
			
		||||
#undef RGB_THEME
 | 
			
		||||
 | 
			
		||||
// Userspace loose colors
 | 
			
		||||
rgb_theme_color_t default_adjust = { HSV_SPRINGGREEN };
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
void keyboard_post_init_rgb(void) {
 | 
			
		||||
    layer_state_set_user(layer_state);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#if defined(RGB_THEME_ENABLE)
 | 
			
		||||
void set_rgb_theme(uint8_t index) {
 | 
			
		||||
    if (!user_config.rgb_layer_change) {
 | 
			
		||||
        user_config.rgb_layer_change = true;
 | 
			
		||||
    }
 | 
			
		||||
    user_config.rgb_theme = index;
 | 
			
		||||
    dprintf("rgb theme [EEPROM]: %u\n", user_config.rgb_theme);
 | 
			
		||||
    eeconfig_update_user(user_config.raw);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
rgb_theme_t get_rgb_theme(void) {
 | 
			
		||||
    return *themes[user_config.rgb_theme];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void rgb_theme_step(void) {
 | 
			
		||||
    uint8_t current = user_config.rgb_theme;
 | 
			
		||||
    current = (current + 1) % RGB_THEME_MAX;
 | 
			
		||||
    set_rgb_theme(current);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void rgb_theme_step_reverse(void) {
 | 
			
		||||
    uint8_t current = user_config.rgb_theme;
 | 
			
		||||
    current = (current - 1) % RGB_THEME_MAX;
 | 
			
		||||
    set_rgb_theme(current);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
rgb_theme_color_t get_rgb_theme_color(uint8_t index) {
 | 
			
		||||
    rgb_theme_t theme = get_rgb_theme();
 | 
			
		||||
    size_t rgb_theme_color_max = sizeof theme.colors / sizeof *theme.colors;
 | 
			
		||||
 | 
			
		||||
    if (index == _ADJUST) {
 | 
			
		||||
        return default_adjust;
 | 
			
		||||
    } else {
 | 
			
		||||
        return **(theme.colors + (index % rgb_theme_color_max));
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
void rgb_theme_layer(layer_state_t state) {
 | 
			
		||||
    uint8_t rgb_color_index = get_highest_layer(state);
 | 
			
		||||
    HSV color = get_rgb_theme_color(rgb_color_index);
 | 
			
		||||
#if defined(RGBLIGHT_ENABLE)
 | 
			
		||||
    color.v = rgblight_config.val;
 | 
			
		||||
#elif defined(RGB_MATRIX_ENABLE)
 | 
			
		||||
    color.v = rgb_matrix_config.hsv.v;
 | 
			
		||||
#endif
 | 
			
		||||
    rgb_layer_helper( color.h, color.s, color.v );
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef RGB_MATRIX_ENABLE
 | 
			
		||||
void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, uint8_t led_type) {
 | 
			
		||||
    for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
 | 
			
		||||
        if (!HAS_ANY_FLAGS(g_led_config.flags[i], led_type)) {
 | 
			
		||||
            rgb_matrix_set_color( i, red, green, blue );
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void rgb_matrix_cycle_flag (void) {
 | 
			
		||||
    switch (rgb_matrix_get_flags()) {
 | 
			
		||||
        case LED_FLAG_ALL:
 | 
			
		||||
            rgb_matrix_set_flags(LED_FLAG_KEYS);
 | 
			
		||||
            rgb_matrix_set_color_all(0, 0, 0);
 | 
			
		||||
            break;
 | 
			
		||||
        case LED_FLAG_KEYS:
 | 
			
		||||
            rgb_matrix_set_flags(LED_FLAG_UNDERGLOW);
 | 
			
		||||
            rgb_matrix_set_color_all(0, 0, 0);
 | 
			
		||||
            break;
 | 
			
		||||
        case LED_FLAG_UNDERGLOW:
 | 
			
		||||
            rgb_matrix_set_flags(LED_FLAG_NONE);
 | 
			
		||||
            rgb_matrix_set_color_all(0, 0, 0);
 | 
			
		||||
            break;
 | 
			
		||||
        default:
 | 
			
		||||
            rgb_matrix_set_flags(LED_FLAG_ALL);
 | 
			
		||||
            rgb_matrix_enable();
 | 
			
		||||
            break;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
void rgb_layer_helper(uint8_t hue, uint8_t sat, uint8_t val) {
 | 
			
		||||
#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
 | 
			
		||||
    rgblight_sethsv_noeeprom(hue, sat, val);
 | 
			
		||||
#ifdef RGB_MATRIX_ENABLE
 | 
			
		||||
    rgb_matrix_layer_helper(0, 0, 0, rgb_matrix_get_flags());
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
layer_state_t layer_state_set_rgb(layer_state_t state) {
 | 
			
		||||
#if defined(RGB_THEME_ENABLE)
 | 
			
		||||
    if (user_config.rgb_layer_change) {
 | 
			
		||||
        rgb_theme_layer(state);
 | 
			
		||||
    }
 | 
			
		||||
#endif // RGBLIGHT_ENABLE
 | 
			
		||||
    return state;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										35
									
								
								users/brandonschlack/rgb_bs.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								users/brandonschlack/rgb_bs.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,35 @@
 | 
			
		|||
/* Copyright 2020 Brandon Schlack
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 2 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
#pragma once
 | 
			
		||||
#include "quantum.h"
 | 
			
		||||
#ifdef RGB_THEME_ENABLE
 | 
			
		||||
#   include "rgb_theme.h"
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef RGB_MATRIX_ENABLE
 | 
			
		||||
#   include "rgb_matrix.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef RGB_MATRIX_ENABLE
 | 
			
		||||
#define LED_FLAG_KEYS (LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER)
 | 
			
		||||
 | 
			
		||||
void rgb_matrix_layer_helper(uint8_t red, uint8_t green, uint8_t blue, uint8_t led_type);
 | 
			
		||||
void rgb_matrix_cycle_flag(void);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
void keyboard_post_init_rgb(void);
 | 
			
		||||
void rgb_layer_helper(uint8_t hue, uint8_t sat, uint8_t val);
 | 
			
		||||
 | 
			
		||||
layer_state_t layer_state_set_rgb(layer_state_t state);
 | 
			
		||||
							
								
								
									
										51
									
								
								users/brandonschlack/rgb_theme.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								users/brandonschlack/rgb_theme.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,51 @@
 | 
			
		|||
/* Copyright 2020 Brandon Schlack
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 2 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include "brandonschlack.h"
 | 
			
		||||
#include "color.h"
 | 
			
		||||
#include "rgblight_list.h"
 | 
			
		||||
 | 
			
		||||
/*TODO Update as RGBLIGHT Mode */
 | 
			
		||||
#ifndef RGB_THEME_COLORS_MAX
 | 
			
		||||
#define RGB_THEME_COLORS_MAX 5
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
enum rgb_themes {
 | 
			
		||||
#define RGB_THEME(name) RGB_THEME_##name,
 | 
			
		||||
    #include "rgb_theme_user.inc"
 | 
			
		||||
#undef RGB_THEME
 | 
			
		||||
    RGB_THEME_MAX
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
// RGB Theme Color
 | 
			
		||||
typedef const HSV rgb_theme_color_t;
 | 
			
		||||
#define RGB_THEME_COLOR(tname, tcolor,...)   rgb_theme_color_t tname ## _ ## tcolor = { __VA_ARGS__ }
 | 
			
		||||
 | 
			
		||||
// RGB Theme
 | 
			
		||||
typedef struct {
 | 
			
		||||
    const HSV *colors[RGB_THEME_COLORS_MAX];
 | 
			
		||||
} rgb_theme_t;
 | 
			
		||||
extern const rgb_theme_t *themes[];
 | 
			
		||||
 | 
			
		||||
void set_rgb_theme(uint8_t index);
 | 
			
		||||
rgb_theme_t get_rgb_theme(void);
 | 
			
		||||
 | 
			
		||||
void rgb_theme_step(void);
 | 
			
		||||
void rgb_theme_step_reverse(void);
 | 
			
		||||
 | 
			
		||||
rgb_theme_color_t get_rgb_theme_color(uint8_t index);
 | 
			
		||||
void rgb_theme_layer(layer_state_t state);
 | 
			
		||||
							
								
								
									
										95
									
								
								users/brandonschlack/rgb_theme_user.inc
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										95
									
								
								users/brandonschlack/rgb_theme_user.inc
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,95 @@
 | 
			
		|||
// Basic Theme
 | 
			
		||||
#ifndef DISABLE_RGB_THEME_BASIC
 | 
			
		||||
#ifndef RGB_THEME_IMPLS
 | 
			
		||||
RGB_THEME(BASIC)
 | 
			
		||||
#else
 | 
			
		||||
RGB_THEME_COLOR(BASIC, WHITE, HSV_WHITE);
 | 
			
		||||
RGB_THEME_COLOR(BASIC, BLUE, HSV_BLUE);
 | 
			
		||||
RGB_THEME_COLOR(BASIC, RED, HSV_RED);
 | 
			
		||||
RGB_THEME_COLOR(BASIC, GREEN, HSV_GREEN);
 | 
			
		||||
RGB_THEME_COLOR(BASIC, YELLOW, HSV_YELLOW);
 | 
			
		||||
RGB_THEME(BASIC) = { { &BASIC_WHITE, &BASIC_BLUE, &BASIC_RED, &BASIC_GREEN, &BASIC_YELLOW } };
 | 
			
		||||
#endif // RGB_THEME_IMPLS
 | 
			
		||||
#endif // DISABLE_RGB_THEME_BASIC
 | 
			
		||||
 | 
			
		||||
// Laser Theme
 | 
			
		||||
#ifndef DISABLE_RGB_THEME_LASER
 | 
			
		||||
#ifndef RGB_THEME_IMPLS
 | 
			
		||||
RGB_THEME(LASER)
 | 
			
		||||
#else
 | 
			
		||||
RGB_THEME_COLOR(LASER, PURPLE, 191, 255, 255);
 | 
			
		||||
RGB_THEME_COLOR(LASER, PINK, 237, 255, 255);
 | 
			
		||||
RGB_THEME_COLOR(LASER, BLUE, 165, 255, 255);
 | 
			
		||||
RGB_THEME_COLOR(LASER, CYAN, 133, 255, 255);
 | 
			
		||||
RGB_THEME_COLOR(LASER, MAGENTA, 213, 255, 255);
 | 
			
		||||
RGB_THEME(LASER) = { { &LASER_PURPLE, &LASER_PINK, &LASER_BLUE, &LASER_CYAN, &LASER_MAGENTA } };
 | 
			
		||||
#endif // RGB_THEME_IMPLS
 | 
			
		||||
#endif // DISABLE_RGB_THEME_LASER
 | 
			
		||||
 | 
			
		||||
// Metropolis Theme
 | 
			
		||||
#ifndef DISABLE_RGB_THEME_METROPOLIS
 | 
			
		||||
#ifndef RGB_THEME_IMPLS
 | 
			
		||||
RGB_THEME(METROPOLIS)
 | 
			
		||||
#else
 | 
			
		||||
RGB_THEME_COLOR(METROPOLIS, TEAL,   96,  207, 255);
 | 
			
		||||
RGB_THEME_COLOR(METROPOLIS, RED,    HSV_RED);
 | 
			
		||||
RGB_THEME_COLOR(METROPOLIS, YELLOW, 24,  255, 255);
 | 
			
		||||
RGB_THEME_COLOR(METROPOLIS, BLUE,   168, 255, 255);
 | 
			
		||||
RGB_THEME_COLOR(METROPOLIS, WHITE,  HSV_WHITE);
 | 
			
		||||
RGB_THEME(METROPOLIS) = { { &METROPOLIS_TEAL, &METROPOLIS_RED, &METROPOLIS_YELLOW, &METROPOLIS_BLUE, &METROPOLIS_WHITE } };
 | 
			
		||||
#endif // RGB_THEME_IMPLS
 | 
			
		||||
#endif // DISABLE_RGB_THEME_METROPOLIS
 | 
			
		||||
 | 
			
		||||
// Canvas Theme
 | 
			
		||||
#ifndef DISABLE_RGB_THEME_CANVAS
 | 
			
		||||
#ifndef RGB_THEME_IMPLS
 | 
			
		||||
RGB_THEME(CANVAS)
 | 
			
		||||
#else
 | 
			
		||||
RGB_THEME_COLOR(CANVAS, WHITE,  HSV_WHITE);
 | 
			
		||||
RGB_THEME_COLOR(CANVAS, ORANGE, 10,  255, 255);
 | 
			
		||||
RGB_THEME_COLOR(CANVAS, RED,     0,  231, 255);
 | 
			
		||||
RGB_THEME_COLOR(CANVAS, GREEN,  74,  207, 255);
 | 
			
		||||
RGB_THEME_COLOR(CANVAS, BLUE,  170,  135, 255);
 | 
			
		||||
RGB_THEME(CANVAS) = { { &CANVAS_WHITE, &CANVAS_ORANGE, &CANVAS_RED, &CANVAS_GREEN, &CANVAS_BLUE } };
 | 
			
		||||
#endif // RGB_THEME_IMPLS
 | 
			
		||||
#endif // DISABLE_RGB_THEME_CANVAS
 | 
			
		||||
 | 
			
		||||
// Jamon Theme
 | 
			
		||||
#ifndef DISABLE_RGB_THEME_JAMON
 | 
			
		||||
#ifndef RGB_THEME_IMPLS
 | 
			
		||||
RGB_THEME(JAMON)
 | 
			
		||||
#else
 | 
			
		||||
RGB_THEME_COLOR(JAMON, RED, HSV_RED);
 | 
			
		||||
RGB_THEME_COLOR(JAMON, LIGHTRED, 4,  255, 255);
 | 
			
		||||
RGB_THEME_COLOR(JAMON, WHITE,  HSV_WHITE);
 | 
			
		||||
RGB_THEME_COLOR(JAMON, YELLOW,  HSV_GOLD);
 | 
			
		||||
RGB_THEME(JAMON) = { { &JAMON_RED, &JAMON_LIGHTRED, &JAMON_WHITE, &JAMON_YELLOW } };
 | 
			
		||||
#endif // RGB_THEME_IMPLS
 | 
			
		||||
#endif // DISABLE_RGB_THEME_JAMON
 | 
			
		||||
 | 
			
		||||
// Striker Theme
 | 
			
		||||
#ifndef DISABLE_RGB_THEME_STRIKER
 | 
			
		||||
#ifndef RGB_THEME_IMPLS
 | 
			
		||||
RGB_THEME(STRIKER)
 | 
			
		||||
#else
 | 
			
		||||
RGB_THEME_COLOR(STRIKER, BLUE, HSV_BLUE);
 | 
			
		||||
RGB_THEME_COLOR(STRIKER, AZURE, HSV_AZURE);
 | 
			
		||||
RGB_THEME_COLOR(STRIKER, WHITE,  HSV_WHITE);
 | 
			
		||||
RGB_THEME_COLOR(STRIKER, RED,  HSV_RED);
 | 
			
		||||
RGB_THEME(STRIKER) = { { &STRIKER_BLUE, &STRIKER_AZURE, &STRIKER_WHITE, &STRIKER_RED } };
 | 
			
		||||
#endif // RGB_THEME_IMPLS
 | 
			
		||||
#endif // DISABLE_RGB_THEME_STRIKER
 | 
			
		||||
 | 
			
		||||
// Oblique Theme
 | 
			
		||||
#ifndef DISABLE_RGB_THEME_OBLIQUE
 | 
			
		||||
#ifndef RGB_THEME_IMPLS
 | 
			
		||||
RGB_THEME(OBLIQUE)
 | 
			
		||||
#else
 | 
			
		||||
RGB_THEME_COLOR(OBLIQUE, WHITE, HSV_WHITE);
 | 
			
		||||
RGB_THEME_COLOR(OBLIQUE, PURPLE, 186, 143, 255);
 | 
			
		||||
RGB_THEME_COLOR(OBLIQUE, RED, 10,  200, 255);
 | 
			
		||||
RGB_THEME_COLOR(OBLIQUE, ORANGE, 26,  215, 255);
 | 
			
		||||
RGB_THEME_COLOR(OBLIQUE, GREEN, 58,  199, 255);
 | 
			
		||||
RGB_THEME(OBLIQUE) = { { &OBLIQUE_WHITE, &OBLIQUE_PURPLE, &OBLIQUE_RED, &OBLIQUE_ORANGE, &OBLIQUE_GREEN } };
 | 
			
		||||
#endif // RGB_THEME_IMPLS
 | 
			
		||||
#endif // DISABLE_RGB_THEME_OBLIQUE
 | 
			
		||||
							
								
								
									
										34
									
								
								users/brandonschlack/rules.mk
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								users/brandonschlack/rules.mk
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,34 @@
 | 
			
		|||
SRC += brandonschlack.c \
 | 
			
		||||
       process_records.c
 | 
			
		||||
 | 
			
		||||
SPACE_CADET_ENABLE = no
 | 
			
		||||
 | 
			
		||||
# Use LTO except for ChibiOS
 | 
			
		||||
ifneq ($(PLATFORM),CHIBIOS)
 | 
			
		||||
    LTO_ENABLE            = yes
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(strip $(IS_MACROPAD)), yes)
 | 
			
		||||
    OPT_DEFS += -DIS_MACROPAD
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
 | 
			
		||||
    SRC += rgb_bs.c
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
RGB_MATRIX_ENABLE ?= no
 | 
			
		||||
ifneq ($(strip $(RGB_MATRIX_ENABLE)), no)
 | 
			
		||||
    SRC += rgb_bs.c
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(strip $(TAP_DANCE_ENABLE)), yes)
 | 
			
		||||
    SRC += tap_dances.c
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(strip $(FLASH_BOOTLOADER)), yes)
 | 
			
		||||
    OPT_DEFS += -DFLASH_BOOTLOADER
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifneq ($(FORCE_LAYOUT),)
 | 
			
		||||
    OPT_DEFS += -DFORCE_LAYOUT=\"$(FORCE_LAYOUT)\"
 | 
			
		||||
endif
 | 
			
		||||
							
								
								
									
										91
									
								
								users/brandonschlack/tap_dances.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										91
									
								
								users/brandonschlack/tap_dances.c
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,91 @@
 | 
			
		|||
/* Copyright 2020 Brandon Schlack
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 2 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
#include "tap_dances.h"
 | 
			
		||||
#include "process_keycode/process_tap_dance.h"
 | 
			
		||||
 | 
			
		||||
int cur_dance (qk_tap_dance_state_t *state) {
 | 
			
		||||
    if (state->count == 1) {
 | 
			
		||||
        if (state->interrupted || !state->pressed)  return SINGLE_TAP;
 | 
			
		||||
        else return SINGLE_HOLD;
 | 
			
		||||
    } else if (state->count == 2) {
 | 
			
		||||
        if (state->interrupted) return DOUBLE_SINGLE_TAP;
 | 
			
		||||
        else if (state->pressed) return DOUBLE_HOLD;
 | 
			
		||||
        else return DOUBLE_TAP;
 | 
			
		||||
    }
 | 
			
		||||
    if (state->count == 3) {
 | 
			
		||||
        if (state->interrupted || !state->pressed)  return TRIPLE_TAP;
 | 
			
		||||
        else return TRIPLE_HOLD;
 | 
			
		||||
    }
 | 
			
		||||
    else return 8;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__attribute__ ((weak))
 | 
			
		||||
void process_tap_dance_keycode (bool reset, uint8_t toggle_layer) { };
 | 
			
		||||
 | 
			
		||||
void td_trigger_layer_finished (qk_tap_dance_state_t *state, void *user_data) {
 | 
			
		||||
    qk_tap_dance_trigger_layer_t *data = (qk_tap_dance_trigger_layer_t *)user_data;
 | 
			
		||||
    data->state = cur_dance(state);
 | 
			
		||||
 | 
			
		||||
    if (data->state == data->trigger) {
 | 
			
		||||
        layer_on(data->layer);
 | 
			
		||||
    } else {
 | 
			
		||||
        process_tap_dance_keycode(false, data->layer);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
void td_trigger_layer_reset (qk_tap_dance_state_t *state, void *user_data) {
 | 
			
		||||
    qk_tap_dance_trigger_layer_t *data = (qk_tap_dance_trigger_layer_t *)user_data;
 | 
			
		||||
    if (data->state == data->trigger) {
 | 
			
		||||
        switch (data->trigger) {
 | 
			
		||||
            case SINGLE_HOLD:
 | 
			
		||||
            case DOUBLE_HOLD:
 | 
			
		||||
            case TRIPLE_HOLD:
 | 
			
		||||
                layer_off(data->layer);
 | 
			
		||||
                break;
 | 
			
		||||
        }
 | 
			
		||||
    } else {
 | 
			
		||||
        process_tap_dance_keycode(true, data->layer);
 | 
			
		||||
    }
 | 
			
		||||
    data->state = 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Tap Dance: Layer Mod. Toggles Layer when tapped, Mod when held. */
 | 
			
		||||
void td_layer_mod_each(qk_tap_dance_state_t *state, void *user_data) {
 | 
			
		||||
    qk_tap_dance_dual_role_t *data = (qk_tap_dance_dual_role_t *)user_data;
 | 
			
		||||
 | 
			
		||||
    // Single tap → toggle layer, Single hold → mod
 | 
			
		||||
    if (state->pressed) {
 | 
			
		||||
        register_code(data->kc);
 | 
			
		||||
    } else if (state->count == 1) {
 | 
			
		||||
        state->finished = true;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void td_layer_mod_finished(qk_tap_dance_state_t *state, void *user_data) {
 | 
			
		||||
    qk_tap_dance_dual_role_t *data = (qk_tap_dance_dual_role_t *)user_data;
 | 
			
		||||
 | 
			
		||||
    if (state->count == 1 && !state->pressed) {
 | 
			
		||||
        layer_invert(data->layer);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void td_layer_mod_reset(qk_tap_dance_state_t *state, void *user_data) {
 | 
			
		||||
    qk_tap_dance_dual_role_t *data = (qk_tap_dance_dual_role_t *)user_data;
 | 
			
		||||
 | 
			
		||||
    if (state->count == 1) {
 | 
			
		||||
        unregister_code(data->kc);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										52
									
								
								users/brandonschlack/tap_dances.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								users/brandonschlack/tap_dances.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,52 @@
 | 
			
		|||
/* Copyright 2020 Brandon Schlack
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 2 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
#pragma once
 | 
			
		||||
#include "brandonschlack.h"
 | 
			
		||||
#ifdef TAP_DANCE_ENABLE
 | 
			
		||||
#   include "process_keycode/process_tap_dance.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
enum tap_dance_states {
 | 
			
		||||
    SINGLE_TAP = 1,
 | 
			
		||||
    SINGLE_HOLD = 2,
 | 
			
		||||
    DOUBLE_TAP = 3,
 | 
			
		||||
    DOUBLE_HOLD = 4,
 | 
			
		||||
    DOUBLE_SINGLE_TAP = 5,
 | 
			
		||||
    TRIPLE_TAP = 6,
 | 
			
		||||
    TRIPLE_HOLD = 7
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
int cur_dance (qk_tap_dance_state_t *state);
 | 
			
		||||
void process_tap_dance_keycode (bool reset, uint8_t toggle_layer);
 | 
			
		||||
 | 
			
		||||
/* Tap Dance: Trigger Layer
 | 
			
		||||
 *
 | 
			
		||||
 * Toggles Layer based on given trigger (Single Hold, Double Tap, Double Hold, etc).
 | 
			
		||||
 * Uses process_tap_dance_keycode() to allow keycode defines based on layer
 | 
			
		||||
 */
 | 
			
		||||
typedef struct {
 | 
			
		||||
    uint8_t  trigger;
 | 
			
		||||
    uint8_t  layer;
 | 
			
		||||
    uint8_t  state;
 | 
			
		||||
} qk_tap_dance_trigger_layer_t;
 | 
			
		||||
 | 
			
		||||
#define ACTION_TAP_DANCE_TRIGGER_LAYER(trigger, layer) { \
 | 
			
		||||
    .fn = { NULL, td_trigger_layer_finished, td_trigger_layer_reset }, \
 | 
			
		||||
    .user_data = (void *)&((qk_tap_dance_trigger_layer_t) { trigger, layer, 0 }), \
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void td_trigger_layer_finished (qk_tap_dance_state_t *state, void *user_data);
 | 
			
		||||
void td_trigger_layer_reset (qk_tap_dance_state_t *state, void *user_data);
 | 
			
		||||
| 
						 | 
				
			
			@ -15,6 +15,8 @@
 | 
			
		|||
 */
 | 
			
		||||
 | 
			
		||||
#include "riblee.h"
 | 
			
		||||
#include "raw_hid.h"
 | 
			
		||||
#include <string.h>
 | 
			
		||||
 | 
			
		||||
const uint8_t shift = MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -150,6 +152,12 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
 | 
			
		|||
            }
 | 
			
		||||
            return false;
 | 
			
		||||
            break;
 | 
			
		||||
        case HUNGARIAN:
 | 
			
		||||
            if (record->event.pressed) {
 | 
			
		||||
                set_single_persistent_default_layer(_HUNGARIAN);
 | 
			
		||||
            }
 | 
			
		||||
            return false;
 | 
			
		||||
            break;
 | 
			
		||||
        case BACKLIT:
 | 
			
		||||
            if (record->event.pressed) {
 | 
			
		||||
                register_code(keycode_config(KC_LGUI));
 | 
			
		||||
| 
						 | 
				
			
			@ -164,3 +172,59 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
 | 
			
		|||
    }
 | 
			
		||||
    return true;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#ifdef OLED_DRIVER_ENABLE
 | 
			
		||||
 | 
			
		||||
static char receive_buffer[128] = {};
 | 
			
		||||
static uint8_t receive_buffer_length = 0;
 | 
			
		||||
 | 
			
		||||
void oled_task_user(void) {
 | 
			
		||||
    // Keyboard Layer Status
 | 
			
		||||
    oled_write_P(PSTR("Layer: "), false);
 | 
			
		||||
 | 
			
		||||
    switch (get_highest_layer(layer_state)) {
 | 
			
		||||
        case _QWERTY:
 | 
			
		||||
            oled_write_P(PSTR("Default\n"), false);
 | 
			
		||||
            break;
 | 
			
		||||
        case _LOWER:
 | 
			
		||||
            oled_write_P(PSTR("Lower\n"), false);
 | 
			
		||||
            break;
 | 
			
		||||
        case _RAISE:
 | 
			
		||||
            oled_write_P(PSTR("Raise\n"), false);
 | 
			
		||||
            break;
 | 
			
		||||
        case _ADJUST:
 | 
			
		||||
            oled_write_P(PSTR("Adjust\n"), false);
 | 
			
		||||
            break;
 | 
			
		||||
        default:
 | 
			
		||||
            oled_write_P(PSTR("Undefined\n"), false);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Print string received via HID RAW
 | 
			
		||||
    oled_write_ln(receive_buffer, false);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifdef RAW_ENABLE
 | 
			
		||||
 | 
			
		||||
void raw_hid_receive(uint8_t *data, uint8_t length) {
 | 
			
		||||
 | 
			
		||||
    // Append data to receive_buffer, without the first byte
 | 
			
		||||
    memcpy(receive_buffer + receive_buffer_length, data + 1, length - 1);
 | 
			
		||||
    receive_buffer_length += (length - 1);
 | 
			
		||||
 | 
			
		||||
    // First byte indicate if we will recive more package for the current string
 | 
			
		||||
    // If it's 1 then this was the last package and we can reset the offset
 | 
			
		||||
    if (data[0] == 1) {
 | 
			
		||||
        // Reset the offset for memcpy to the begining of our buffer
 | 
			
		||||
        receive_buffer_length = 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Reset the offset to prevent overwriting memory outside of the buffer
 | 
			
		||||
    if (receive_buffer_length + 32 >= 128) {
 | 
			
		||||
        receive_buffer_length = 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			@ -18,8 +18,9 @@
 | 
			
		|||
 | 
			
		||||
#include QMK_KEYBOARD_H
 | 
			
		||||
 | 
			
		||||
enum preonic_layers {
 | 
			
		||||
enum layer_names {
 | 
			
		||||
    _QWERTY,
 | 
			
		||||
    _HUNGARIAN,
 | 
			
		||||
    _COLEMAK,
 | 
			
		||||
    _DVORAK,
 | 
			
		||||
    _LOWER,
 | 
			
		||||
| 
						 | 
				
			
			@ -27,8 +28,9 @@ enum preonic_layers {
 | 
			
		|||
    _ADJUST
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
enum preonic_keycodes {
 | 
			
		||||
enum custom_keycodes {
 | 
			
		||||
    QWERTY = SAFE_RANGE,
 | 
			
		||||
    HUNGARIAN,
 | 
			
		||||
    COLEMAK,
 | 
			
		||||
    DVORAK,
 | 
			
		||||
    BACKLIT
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,4 +5,7 @@
 | 
			
		|||
#define ONESHOT_TAP_TOGGLE 5
 | 
			
		||||
#define ONESHOT_TIMEOUT 5000
 | 
			
		||||
 | 
			
		||||
#undef TAP_CODE_DELAY
 | 
			
		||||
#define TAP_CODE_DELAY 5 //DEFAULT: 100
 | 
			
		||||
 | 
			
		||||
//#define UNICODE_SCRIPT_MODE_ENABLE
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										118
									
								
								users/rupa/process_records.c
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										118
									
								
								users/rupa/process_records.c
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							| 
						 | 
				
			
			@ -17,7 +17,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		|||
 | 
			
		||||
#include "rupa.h"
 | 
			
		||||
 | 
			
		||||
font_t *translator = NULL;
 | 
			
		||||
uint16_t processed_keycode;
 | 
			
		||||
 | 
			
		||||
__attribute__((weak))
 | 
			
		||||
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
 | 
			
		||||
| 
						 | 
				
			
			@ -25,47 +25,93 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
 | 
			
		||||
    bool is_shifted = get_mods()&MOD_MASK_SHIFT;
 | 
			
		||||
    bool is_pressed = record->event.pressed;
 | 
			
		||||
    if (record->event.pressed) {
 | 
			
		||||
 | 
			
		||||
    switch(keycode) {
 | 
			
		||||
        case VRSN:
 | 
			
		||||
            if (is_pressed) {
 | 
			
		||||
        processed_keycode = keycode;
 | 
			
		||||
        // mask out mod taps
 | 
			
		||||
        if (
 | 
			
		||||
            (keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) ||
 | 
			
		||||
            (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)
 | 
			
		||||
        ) {
 | 
			
		||||
            processed_keycode &= 0xFF;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        bool is_shifted = (get_mods() | get_oneshot_mods() | get_weak_mods()) & MOD_MASK_SHIFT;
 | 
			
		||||
        switch(processed_keycode) {
 | 
			
		||||
            case VRSN:
 | 
			
		||||
                send_string_with_delay_P(PSTR(
 | 
			
		||||
                  "# " QMK_KEYBOARD "/" QMK_KEYMAP ":" QMK_VERSION " " QMK_BUILDDATE "\n"
 | 
			
		||||
                    "# " QMK_KEYBOARD "/" QMK_KEYMAP ":" QMK_VERSION " " QMK_BUILDDATE "\n"
 | 
			
		||||
                ), TAP_CODE_DELAY);
 | 
			
		||||
            }
 | 
			
		||||
            return false;
 | 
			
		||||
                return false;
 | 
			
		||||
 | 
			
		||||
        case LOD:
 | 
			
		||||
        case RUPA:
 | 
			
		||||
            if (is_pressed) {
 | 
			
		||||
                if (keycode == LOD) {
 | 
			
		||||
                    send_unicode_string((is_shifted ? "¯\\_(ツ)_/¯" : "ಠ_ಠ"));
 | 
			
		||||
                } else if (keycode == RUPA) {
 | 
			
		||||
                    send_unicode_string((is_shifted ? "Śrīrūpa" : "rūpa"));
 | 
			
		||||
            case BUGS:
 | 
			
		||||
                return u_xp(is_shifted, "ᙙᙖ", "ଳ");
 | 
			
		||||
            case CATS:
 | 
			
		||||
                return u_xp(is_shifted, "ⓛ ᆽ ⓛ ", "ㅇㅅㅇ");
 | 
			
		||||
            case DANCE:
 | 
			
		||||
                return u_x(dance(is_shifted));
 | 
			
		||||
            case DICE:
 | 
			
		||||
                return u_x(d6());
 | 
			
		||||
            case DOMO:
 | 
			
		||||
                return u_xp(is_shifted, "(シ_ _)シ", "m(_ _)m");
 | 
			
		||||
            case FART:
 | 
			
		||||
                return u_x("⊥ʶ∀Ⅎ");
 | 
			
		||||
            case FLIP:
 | 
			
		||||
                return u_x(flip(is_shifted));
 | 
			
		||||
            case HUGS:
 | 
			
		||||
                return u_xp(is_shifted, "(づ ̄ ³ ̄)づ", "(っಠ‿ಠ)っ");
 | 
			
		||||
            case JOY:
 | 
			
		||||
                return u_x(joy(is_shifted));
 | 
			
		||||
            case RNDM:
 | 
			
		||||
                return false;
 | 
			
		||||
            case KISS:
 | 
			
		||||
                return u_xp(is_shifted, "꒒ ০ ⌵ ୧ ♡", "( ˘ ³˘)♥");
 | 
			
		||||
            case LOD:
 | 
			
		||||
                return u_xp(is_shifted, "( ͡ಠ ʖ̯ ͡ಠ)", "ಠ_ಠ");
 | 
			
		||||
            case MUSIC:
 | 
			
		||||
                return u_xp(is_shifted, "(˳˘ ɜ˘)˳ ♬ ♪♫", "(´▽`)ノ♫");
 | 
			
		||||
            case RUPA:
 | 
			
		||||
                return u_xp(is_shifted, "Śrīrūpa", "rūpa");
 | 
			
		||||
            case SHRUG:
 | 
			
		||||
                return u_xp(is_shifted, "⋌ ༼ •̀ ⌂ •́ ༽⋋", "¯\\_(ツ)_/¯");
 | 
			
		||||
            case TADA:
 | 
			
		||||
                return u_xp(is_shifted, "☆ *・゜゚・*(^O^)/*・゜゚・*☆", "\\(゜ロ\\)Ξ(//ロ゜)//");
 | 
			
		||||
            case WAT:
 | 
			
		||||
                return u_xp(is_shifted, "༼  ຶཽཀ  ຶཽ༽", "ヽ༼⊙_⊙༽ノ");
 | 
			
		||||
            case YUNO:
 | 
			
		||||
                return u_xp(is_shifted, "o(^^o)", "щ(゜ロ゜щ)");
 | 
			
		||||
            case ZALGO:
 | 
			
		||||
                set_combined_mode(CM_ZALGO);
 | 
			
		||||
                break;
 | 
			
		||||
            case ZZZZZ:
 | 
			
		||||
                cycle_combined_mode();
 | 
			
		||||
                break;
 | 
			
		||||
 | 
			
		||||
#if defined(UNICODE_SCRIPT_MODE_ENABLE)
 | 
			
		||||
            // script modes
 | 
			
		||||
            case U_FRACT:
 | 
			
		||||
                return set_script_mode(F_FRACT);
 | 
			
		||||
            case U_ITALI:
 | 
			
		||||
                return set_script_mode(F_ITALI);
 | 
			
		||||
            case U_MONOS:
 | 
			
		||||
                return set_script_mode(F_MONOS);
 | 
			
		||||
            case U_NORML:
 | 
			
		||||
                return set_script_mode(F_NORML);
 | 
			
		||||
            case U_SANSI:
 | 
			
		||||
                return set_script_mode(F_SANSI);
 | 
			
		||||
            case U_SANSN:
 | 
			
		||||
                return set_script_mode(F_SANSN);
 | 
			
		||||
            case U_SCRPT:
 | 
			
		||||
                return set_script_mode(F_SCRPT);
 | 
			
		||||
 | 
			
		||||
            default:
 | 
			
		||||
                if (get_script_mode() != NULL) {
 | 
			
		||||
                    return script_mode_translate(is_shifted, processed_keycode);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            return false;
 | 
			
		||||
 | 
			
		||||
        // script modes
 | 
			
		||||
        case U_FRACT:
 | 
			
		||||
        case U_MONOS:
 | 
			
		||||
        case U_SCRPT:
 | 
			
		||||
            if (is_pressed) {
 | 
			
		||||
                if (keycode == U_SCRPT) {
 | 
			
		||||
                    translator = (translator == &script_bold ? NULL : &script_bold);
 | 
			
		||||
                } else if (keycode == U_FRACT) {
 | 
			
		||||
                    translator = (translator == &fraktu_bold ? NULL : &fraktu_bold);
 | 
			
		||||
                } else if (keycode == U_MONOS) {
 | 
			
		||||
                    translator = (translator == &monosp_bold ? NULL : &monosp_bold);
 | 
			
		||||
                if (combined_mode != CM_NULL && combined_text(processed_keycode)) {
 | 
			
		||||
                    return false;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            return true;
 | 
			
		||||
 | 
			
		||||
        default:
 | 
			
		||||
            if (is_pressed && translator != NULL) {
 | 
			
		||||
                return script_mode_translate(translator, is_shifted, keycode);
 | 
			
		||||
#endif
 | 
			
		||||
            }
 | 
			
		||||
    }
 | 
			
		||||
    return process_record_keymap(keycode, record);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										0
									
								
								users/rupa/process_records.h
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										0
									
								
								users/rupa/process_records.h
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
								
								
									
										7
									
								
								users/rupa/readme.md
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								users/rupa/readme.md
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,7 @@
 | 
			
		|||
# rupa's userspace
 | 
			
		||||
 | 
			
		||||
* rupa.c has some unicode script mode stuff
 | 
			
		||||
* unicode.c has my unicode map
 | 
			
		||||
* process_record.c has my keycode handler
 | 
			
		||||
 | 
			
		||||
my keymap is in [keyboards/tada68](../../keyboards/tada68/keymaps/rupa/)
 | 
			
		||||
| 
						 | 
				
			
			@ -1,3 +1,5 @@
 | 
			
		|||
UNICODEMAP_ENABLE = yes
 | 
			
		||||
LTO_ENABLE = yes
 | 
			
		||||
SRC += rupa.c \
 | 
			
		||||
       process_records.c \
 | 
			
		||||
       unicode.c
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										43
									
								
								users/rupa/rupa.c
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										43
									
								
								users/rupa/rupa.c
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							| 
						 | 
				
			
			@ -18,14 +18,46 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		|||
#include <print.h>
 | 
			
		||||
#include "rupa.h"
 | 
			
		||||
 | 
			
		||||
#if defined(UNICODE_SCRIPT_MODE_ENABLE)
 | 
			
		||||
const font_t * translator = NULL;
 | 
			
		||||
 | 
			
		||||
// https://en.wikipedia.org/wiki/Mathematical_Alphanumeric_Symbols
 | 
			
		||||
font_t script_bold = {0x1D4D0, 0x1D4EA, 0x1D7CE}; // with bold numbers
 | 
			
		||||
font_t fraktu_bold = {0x1D56C, 0x1D586, 0x1D7D8}; // with doublestruck numbers
 | 
			
		||||
font_t monosp_bold = {0x1D670, 0x1D68A, 0x1D7F6};
 | 
			
		||||
static const font_t *fonts_map[] = {
 | 
			
		||||
    [F_FRACT] = &(font_t){0x1D56C, 0x1D586, 0x1D7D8}, // fraktur/doublestruck numbers
 | 
			
		||||
    [F_ITALI] = &(font_t){0x1D468, 0x1D482, 0x1D7CE}, // italic/bold numbers
 | 
			
		||||
    [F_MONOS] = &(font_t){0x1D670, 0x1D68A, 0x1D7F6}, // monospace
 | 
			
		||||
    [F_NORML] = &(font_t){0x1D400, 0x1D41A, 0x00030}, // normal!
 | 
			
		||||
    [F_SANSI] = &(font_t){0x1D63C, 0x1D656, 0x1D7EC}, // sans 1talic/sans bold numbers
 | 
			
		||||
    [F_SANSN] = &(font_t){0x1D5D4, 0x1D5EE, 0x1D7E2}, // sans normal/sans numbers
 | 
			
		||||
    [F_SCRPT] = &(font_t){0x1D4D0, 0x1D4EA, 0x1D7CE}, // script/bold numbers
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
font_t doublestruc = {0x1D538, 0x1D552, 0x1D7D8};
 | 
			
		||||
uint_32 []snowflakes = {
 | 
			
		||||
  // doublestruck
 | 
			
		||||
  0x1D53B, // C
 | 
			
		||||
  0x1D540, // H
 | 
			
		||||
  0x1D546, // N
 | 
			
		||||
  0x1D548, // P
 | 
			
		||||
  0x1D549, // Q
 | 
			
		||||
  0x1D54A, // R
 | 
			
		||||
  0x1D552, // Z
 | 
			
		||||
};
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
const font_t *get_script_mode(void) {
 | 
			
		||||
    return translator;
 | 
			
		||||
}
 | 
			
		||||
bool set_script_mode(int fc) {
 | 
			
		||||
    translator = translator == fonts_map[fc] ? NULL : fonts_map[fc];
 | 
			
		||||
    dprintf("set_script_mode: %u %b\n", fc, translator != NULL);
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Maps A-Z, a-z, and 0-9 to other unicode ranges. We also map space to EN
 | 
			
		||||
// SPACE for some reason :)
 | 
			
		||||
uint32_t map_alnum(font_t *f, bool is_shifted, uint32_t keycode) {
 | 
			
		||||
uint32_t map_alnum(const font_t *f, bool is_shifted, uint32_t keycode) {
 | 
			
		||||
    switch (keycode) {
 | 
			
		||||
        case KC_SPACE:
 | 
			
		||||
            return (is_shifted ? 0 : 0x2002); // EN SPACE
 | 
			
		||||
| 
						 | 
				
			
			@ -40,10 +72,11 @@ uint32_t map_alnum(font_t *f, bool is_shifted, uint32_t keycode) {
 | 
			
		|||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool script_mode_translate(font_t *translator, bool is_shifted, uint32_t keycode) {
 | 
			
		||||
bool script_mode_translate(bool is_shifted, uint32_t keycode) {
 | 
			
		||||
    uint32_t translated = map_alnum(translator, is_shifted, keycode);
 | 
			
		||||
    if (translated == 0) return true;
 | 
			
		||||
    dprintf("script_mode_translate: %u => %d\n", keycode, translated);
 | 
			
		||||
    register_unicode(translated);
 | 
			
		||||
    return false;
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										50
									
								
								users/rupa/rupa.h
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										50
									
								
								users/rupa/rupa.h
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							| 
						 | 
				
			
			@ -20,19 +20,55 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		|||
#include "version.h"
 | 
			
		||||
#include "process_records.h"
 | 
			
		||||
#include "unicode.h"
 | 
			
		||||
#include "wrappers.h"
 | 
			
		||||
 | 
			
		||||
enum userspace_layers {
 | 
			
		||||
    _QWERTY = 0,
 | 
			
		||||
    _LOWER,
 | 
			
		||||
    _RAISE,
 | 
			
		||||
    _ADJUST
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
enum userspace_custom_keycodes {
 | 
			
		||||
    VRSN = SAFE_RANGE,
 | 
			
		||||
    BUGS,
 | 
			
		||||
    CATS,
 | 
			
		||||
    DANCE,
 | 
			
		||||
    DICE,
 | 
			
		||||
    DOMO,
 | 
			
		||||
    FART,
 | 
			
		||||
    FLIP,
 | 
			
		||||
    HUGS,
 | 
			
		||||
    JOY,
 | 
			
		||||
    KISS,
 | 
			
		||||
    LOD,
 | 
			
		||||
    MUSIC,
 | 
			
		||||
    RNDM,
 | 
			
		||||
    RUPA,
 | 
			
		||||
    SHRUG,
 | 
			
		||||
    TADA,
 | 
			
		||||
    U_FRACT,
 | 
			
		||||
    U_ITALI,
 | 
			
		||||
    U_MONOS,
 | 
			
		||||
    U_NORML,
 | 
			
		||||
    U_SANSI,
 | 
			
		||||
    U_SANSN,
 | 
			
		||||
    U_SCRPT,
 | 
			
		||||
    WAT,
 | 
			
		||||
    YUNO,
 | 
			
		||||
    ZALGO,
 | 
			
		||||
    ZZZZZ,
 | 
			
		||||
    NEXT_SAFE_RANGE
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
enum userspace_font_choices {
 | 
			
		||||
    F_FRACT = 0,
 | 
			
		||||
    F_ITALI,
 | 
			
		||||
    F_MONOS,
 | 
			
		||||
    F_NORML,
 | 
			
		||||
    F_SANSI,
 | 
			
		||||
    F_SANSN,
 | 
			
		||||
    F_SCRPT
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
typedef struct font_t {
 | 
			
		||||
| 
						 | 
				
			
			@ -41,14 +77,6 @@ typedef struct font_t {
 | 
			
		|||
    uint32_t zero_glyph;
 | 
			
		||||
} font_t;
 | 
			
		||||
 | 
			
		||||
font_t fraktu_bold;
 | 
			
		||||
font_t monosp_bold;
 | 
			
		||||
font_t script_bold;
 | 
			
		||||
 | 
			
		||||
bool script_mode_translate(font_t *translator, bool is_shifted, uint32_t keycode);
 | 
			
		||||
 | 
			
		||||
#define RAISE   MO(_RAISE)
 | 
			
		||||
#define OS_RGUI OSM(MOD_RGUI)
 | 
			
		||||
#define OS_RALT OSM(MOD_RALT)
 | 
			
		||||
#define OS_RCTL OSM(MOD_RCTL)
 | 
			
		||||
#define OS_RSFT OSM(MOD_RSFT)
 | 
			
		||||
const font_t* get_script_mode(void);
 | 
			
		||||
bool set_script_mode(int fc);
 | 
			
		||||
bool script_mode_translate(bool is_shifted, uint32_t keycode);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										167
									
								
								users/rupa/unicode.c
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										167
									
								
								users/rupa/unicode.c
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							| 
						 | 
				
			
			@ -17,26 +17,155 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		|||
 | 
			
		||||
#include "unicode.h"
 | 
			
		||||
 | 
			
		||||
combined_mode_t combined_mode = CM_NULL;
 | 
			
		||||
bool _seeded = false;
 | 
			
		||||
 | 
			
		||||
#if defined(UNICODEMAP_ENABLE)
 | 
			
		||||
const uint32_t PROGMEM unicode_map[] = {
 | 
			
		||||
    [CHEK] = 0x2713, // ✓
 | 
			
		||||
    /*
 | 
			
		||||
    [DI1]  = 0x2680, // ⚀
 | 
			
		||||
    [DI2]  = 0x2681, // ⚁
 | 
			
		||||
    [DI3]  = 0x2682, // ⚂
 | 
			
		||||
    [DI4]  = 0x2683, // ⚃
 | 
			
		||||
    [DI5]  = 0x2684, // ⚄
 | 
			
		||||
    [DI6]  = 0x2685, // ⚅
 | 
			
		||||
    */
 | 
			
		||||
    [HAS]  = 0x262D, // ☭
 | 
			
		||||
    [IBNG] = 0x203D, // ‽
 | 
			
		||||
    [IRNY] = 0x2E2E, // ⸮
 | 
			
		||||
    [M4]   = 0x2669, // ♩
 | 
			
		||||
    [M8]   = 0x266A, // ♪
 | 
			
		||||
    [M8B]  = 0x266B, // ♫
 | 
			
		||||
    [M16]  = 0x266C, // ♬
 | 
			
		||||
    [OM]   = 0x0950, // ॐ
 | 
			
		||||
    [STB]  = 0x2605, // ★
 | 
			
		||||
    [STW]  = 0x2606, // ☆
 | 
			
		||||
    [CCIR] = 0x20DD,  // COMBINING CIRCLE  ⃝
 | 
			
		||||
    [CENT] = 0x00A2,  // ¢
 | 
			
		||||
    [CHEK] = 0x2713,  // ✓
 | 
			
		||||
    [CKEY] = 0x20E3,  // COMBINING KEYCAP  ⃣
 | 
			
		||||
    [CUI]  = 0x26A0,  // ⚠
 | 
			
		||||
    [ECKS] = 0x2716,  // ✖
 | 
			
		||||
    [EFF]  = 0x017F,  // ſ
 | 
			
		||||
    [HAS]  = 0x262D,  // ☭
 | 
			
		||||
    [HUN]  = 0x1F4AF, // 💯
 | 
			
		||||
    [IBNG] = 0x203D,  // ‽
 | 
			
		||||
    [IRNY] = 0x2E2E,  // ⸮
 | 
			
		||||
    [LALL] = 0x2200,  // ∀
 | 
			
		||||
    [LELM] = 0x2208,  // ∈
 | 
			
		||||
    [LEXI] = 0x2203,  // ∃
 | 
			
		||||
    [LPRO] = 0x22A2,  // ⊢
 | 
			
		||||
    [M4]   = 0x2669,  // ♩
 | 
			
		||||
    [M8]   = 0x266A,  // ♪
 | 
			
		||||
    [M8B]  = 0x266B,  // ♫
 | 
			
		||||
    [M16]  = 0x266C,  // ♬
 | 
			
		||||
    [NEG]  = 0x20E0,  // COMBINING NO  ⃠
 | 
			
		||||
    [NOPE] = 0x1F6AB, // 🚫
 | 
			
		||||
    [NUM]  = 0x2116,  // №
 | 
			
		||||
    [OM]   = 0x0950,  // ॐ
 | 
			
		||||
    [SMB]  = 0x263A,  // ☻
 | 
			
		||||
    [SMW]  = 0x263B,  // ☺
 | 
			
		||||
    [STB]  = 0x2605,  // ★
 | 
			
		||||
    [STOP] = 0x26D4,  // ⛔
 | 
			
		||||
    [STW]  = 0x2606,  // ☆
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
const char *d6_map[] = {
 | 
			
		||||
    "⚀", "⚁", "⚂", "⚃", "⚄", "⚅"
 | 
			
		||||
};
 | 
			
		||||
const char *dance_map[] = {
 | 
			
		||||
    "〜( ̄▽ ̄〜)",
 | 
			
		||||
    "(〜 ̄▽ ̄)〜"
 | 
			
		||||
};
 | 
			
		||||
const char *dance_more_map[] = {
 | 
			
		||||
    "ƪ(˘⌣˘)┐",
 | 
			
		||||
    "┌(˘⌣˘)ʃ"
 | 
			
		||||
};
 | 
			
		||||
const char *flip_map[] = {
 | 
			
		||||
    "(╯°□°)╯︵ ┻━━┻",
 | 
			
		||||
    "(ノ-_-)ノ・・ ┻━━┻",
 | 
			
		||||
    "(ノꐦ⊙曲ఠ)ノ彡┻━┻"
 | 
			
		||||
};
 | 
			
		||||
const char *flip_back_map[] = {
 | 
			
		||||
    "┬──┬◡ノ(° -°ノ)",
 | 
			
		||||
    "┬──┬ノ( ゜-゜ノ)",
 | 
			
		||||
    "┬──┬ノ(ಠ_ಠノ)"
 | 
			
		||||
};
 | 
			
		||||
const char *joy_map[] = {
 | 
			
		||||
    "ᕕ( ᐛ )ᕗ ",
 | 
			
		||||
    "٩(ˊᗜˋ*)و",
 | 
			
		||||
    "٩( ᐛ )و"
 | 
			
		||||
};
 | 
			
		||||
const char *joy_harder_map[] = {
 | 
			
		||||
    "\\\ ٩( ᐛ )و //",
 | 
			
		||||
    "✧*。٩(ˊᗜˋ*)و✧*。"
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
const char *choice(const char *choices[], int size) {
 | 
			
		||||
    if (_seeded == false) {
 | 
			
		||||
        srand(timer_read32());
 | 
			
		||||
        dprintf("_seeded the roll\n");
 | 
			
		||||
        _seeded = true;
 | 
			
		||||
    }
 | 
			
		||||
    return choices[rand() % size];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const char *d6(void) {
 | 
			
		||||
    return choice(d6_map, 6);
 | 
			
		||||
}
 | 
			
		||||
const char *dance(bool more) {
 | 
			
		||||
    if (more) {
 | 
			
		||||
        return choice(dance_more_map, 2);
 | 
			
		||||
    }
 | 
			
		||||
    return choice(dance_map, 2);
 | 
			
		||||
}
 | 
			
		||||
const char *flip(bool flip_back) {
 | 
			
		||||
    if (flip_back) {
 | 
			
		||||
        return choice(flip_back_map, 3);
 | 
			
		||||
    }
 | 
			
		||||
    return choice(flip_map, 3);
 | 
			
		||||
}
 | 
			
		||||
const char *joy(bool harder) {
 | 
			
		||||
    if (harder) {
 | 
			
		||||
        return choice(joy_harder_map, 2);
 | 
			
		||||
    }
 | 
			
		||||
    return choice(joy_map, 3);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool u_x(const char *text) {
 | 
			
		||||
    send_unicode_string(text);
 | 
			
		||||
    return false;
 | 
			
		||||
};
 | 
			
		||||
bool u_xp(bool is_shifted, const char *shifted, const char *plain) {
 | 
			
		||||
    send_unicode_string(is_shifted ? shifted : plain);
 | 
			
		||||
    return false;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
void zalgo(void) {
 | 
			
		||||
    int number = (rand() % (8 + 1 - 2)) + 2;
 | 
			
		||||
    unsigned int index;
 | 
			
		||||
    for (index=0; index<number; index++) {
 | 
			
		||||
        uint16_t hex = (rand() % (0x036F + 1 - 0x0300)) + 0x0300;
 | 
			
		||||
        register_hex(hex);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool combined_text(uint16_t keycode) {
 | 
			
		||||
    if (keycode < KC_A || (keycode > KC_0 && keycode < KC_MINUS) || keycode > KC_SLASH) {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
    tap_code(keycode);
 | 
			
		||||
    unicode_input_start();
 | 
			
		||||
    switch (combined_mode) {
 | 
			
		||||
        case CM_CIRCLE:
 | 
			
		||||
          register_hex(0x20DD);
 | 
			
		||||
          break;
 | 
			
		||||
        case CM_NO:
 | 
			
		||||
          register_hex(0x20E0);
 | 
			
		||||
          break;
 | 
			
		||||
        case CM_KEYCAP:
 | 
			
		||||
          register_hex(0x20E3);
 | 
			
		||||
          break;
 | 
			
		||||
        case CM_ZALGO:
 | 
			
		||||
          zalgo();
 | 
			
		||||
          break;
 | 
			
		||||
        default:
 | 
			
		||||
          break;
 | 
			
		||||
    }
 | 
			
		||||
    unicode_input_finish();
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void cycle_combined_mode(void) {
 | 
			
		||||
    if (combined_mode++ >= CM_MAX - 1) {
 | 
			
		||||
        combined_mode = CM_NULL;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
combined_mode_t set_combined_mode(combined_mode_t mode) {
 | 
			
		||||
    combined_mode = combined_mode == mode ? CM_NULL : mode;
 | 
			
		||||
    return combined_mode;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										52
									
								
								users/rupa/unicode.h
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										52
									
								
								users/rupa/unicode.h
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							| 
						 | 
				
			
			@ -20,24 +20,58 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		|||
 | 
			
		||||
#if defined(UNICODEMAP_ENABLE)
 | 
			
		||||
enum unicode_names {
 | 
			
		||||
    CHEK,
 | 
			
		||||
    /*
 | 
			
		||||
    DI1, // ⚀
 | 
			
		||||
    DI2, // ⚁
 | 
			
		||||
    DI3, // ⚂
 | 
			
		||||
    DI4, // ⚃
 | 
			
		||||
    DI5, // ⚄
 | 
			
		||||
    DI6, // ⚅
 | 
			
		||||
    */
 | 
			
		||||
    CCIR, // COMBINING  ⃝
 | 
			
		||||
    CENT, // ¢
 | 
			
		||||
    CHEK, // ✓
 | 
			
		||||
    CKEY, // COMBINING  ⃣
 | 
			
		||||
    CUI,  // ⚠
 | 
			
		||||
    ECKS, // ✖
 | 
			
		||||
    EFF,  // ſ
 | 
			
		||||
    HAS,  // ☭
 | 
			
		||||
    HUN,  // 💯
 | 
			
		||||
    IBNG, // ‽
 | 
			
		||||
    IRNY, // ⸮
 | 
			
		||||
    LALL, // ∀
 | 
			
		||||
    LELM, // ∈
 | 
			
		||||
    LEXI, // ∃
 | 
			
		||||
    LPRO, // ⊢
 | 
			
		||||
    M4,   // ♩
 | 
			
		||||
    M8,   // ♪
 | 
			
		||||
    M8B,  // ♫
 | 
			
		||||
    M16,  // ♬
 | 
			
		||||
    NEG,  // COMBINING  ⃠
 | 
			
		||||
    NOPE, // 🚫
 | 
			
		||||
    NUM,  // №
 | 
			
		||||
    OM,   // ॐ
 | 
			
		||||
    SMB,  // ☻
 | 
			
		||||
    SMW,  // ☺
 | 
			
		||||
    STB,  // ★
 | 
			
		||||
    STOP, // ⛔
 | 
			
		||||
    STW,  // ☆
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
typedef enum combined_modes {
 | 
			
		||||
    CM_NULL = 0,
 | 
			
		||||
    CM_CIRCLE,
 | 
			
		||||
    CM_NO,
 | 
			
		||||
    CM_KEYCAP,
 | 
			
		||||
    CM_ZALGO,
 | 
			
		||||
    CM_MAX
 | 
			
		||||
} combined_mode_t;
 | 
			
		||||
 | 
			
		||||
combined_mode_t combined_mode;
 | 
			
		||||
 | 
			
		||||
// random choices
 | 
			
		||||
const char * d6(void);
 | 
			
		||||
const char * dance(bool more);
 | 
			
		||||
const char * flip(bool back);
 | 
			
		||||
const char * joy(bool harder);
 | 
			
		||||
 | 
			
		||||
// like X and XP
 | 
			
		||||
bool u_x(const char *text);
 | 
			
		||||
bool u_xp(bool is_shifted, const char * shifted, const char *plain);
 | 
			
		||||
 | 
			
		||||
bool combined_text(uint16_t keycode);
 | 
			
		||||
void cycle_combined_mode(void);
 | 
			
		||||
combined_mode_t set_combined_mode(combined_mode_t mode);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										122
									
								
								users/rupa/wrappers.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										122
									
								
								users/rupa/wrappers.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,122 @@
 | 
			
		|||
/*
 | 
			
		||||
Copyright 2020 rupa <rupa@lrrr.us> @rupa
 | 
			
		||||
 | 
			
		||||
This program is free software: you can redistribute it and/or modify
 | 
			
		||||
it under the terms of the GNU General Public License as published by
 | 
			
		||||
the Free Software Foundation, either version 2 of the License, or
 | 
			
		||||
(at your option) any later version.
 | 
			
		||||
 | 
			
		||||
This program is distributed in the hope that it will be useful,
 | 
			
		||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
GNU General Public License for more details.
 | 
			
		||||
 | 
			
		||||
You should have received a copy of the GNU General Public License
 | 
			
		||||
along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
#pragma once
 | 
			
		||||
#include "rupa.h"
 | 
			
		||||
 | 
			
		||||
#define LOWER   MO(_LOWER)
 | 
			
		||||
#define RAISE   MO(_RAISE)
 | 
			
		||||
#define OS_RGUI OSM(MOD_RGUI)
 | 
			
		||||
#define OS_RALT OSM(MOD_RALT)
 | 
			
		||||
#define OS_RCTL OSM(MOD_RCTL)
 | 
			
		||||
#define OS_RSFT OSM(MOD_RSFT)
 | 
			
		||||
 | 
			
		||||
#define G_LWR   LT(_LOWER, KC_G)
 | 
			
		||||
 | 
			
		||||
#if defined(UNICODEMAP_ENABLE)
 | 
			
		||||
#    define CSHAPES XP(CCIR,CKEY)
 | 
			
		||||
#    define CUIDADO XP(CUI,HAS)
 | 
			
		||||
#    define NOPENAH XP(NOPE,STOP)
 | 
			
		||||
#    define MUSIC_A XP(M4,M8)
 | 
			
		||||
#    define MUSIC_B XP(M8B,M16)
 | 
			
		||||
#    define SMILE   XP(SMB,SMW)
 | 
			
		||||
#    define STARS   XP(STB,STW)
 | 
			
		||||
#    define YEPYEP  XP(CHEK,HUN)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/* _QWERTY
 | 
			
		||||
 * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┬───┐
 | 
			
		||||
 * │Es~│ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ Backsp│~ `│
 | 
			
		||||
 * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┼───┤
 | 
			
		||||
 * │ Tab │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │  \  │Del│
 | 
			
		||||
 * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┼───┤
 | 
			
		||||
 * │RAISE │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │  Enter │PgU│
 | 
			
		||||
 * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┬───┼───┤
 | 
			
		||||
 * │ Shift  │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │ Shift│ ↑ │PgD│
 | 
			
		||||
 * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴──┬┴──┬┴──┬───┼───┼───┤
 | 
			
		||||
 * │Ctrl│Alt │Gui │        Space           │RAI│LOW│CAP│ ← │ ↓ │ → │
 | 
			
		||||
 * └────┴────┴────┴────────────────────────┴───┴───┴───┴───┴───┴───┘
 | 
			
		||||
 */
 | 
			
		||||
#define ____65_QWERTY______________ROW1    KC_GESC, KC_1,    KC_2,    KC_3,    KC_4,    KC_5,    KC_6,    KC_7,    KC_8,    KC_9,    KC_0,    KC_MINS, KC_EQL,  KC_BSPC, KC_GRV
 | 
			
		||||
#define ____65_QWERTY______________ROW2    KC_TAB,  KC_Q,    KC_W,    KC_E,    KC_R,    KC_T,    KC_Y,    KC_U,    KC_I,    KC_O,    KC_P,    KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL
 | 
			
		||||
#define ____65_QWERTY______________ROW3    RAISE,   KC_A,    KC_S,    KC_D,    KC_F,    G_LWR,   KC_H,    KC_J,    KC_K,    KC_L,    KC_SCLN, KC_QUOT,          KC_ENT,  KC_PGUP
 | 
			
		||||
#define ____65_QWERTY______________ROW4    KC_LSFT,          KC_Z,    KC_X,    KC_C,    KC_V,    KC_B,    KC_N,    KC_M,    KC_COMM, KC_DOT,  KC_SLSH, KC_RSFT, KC_UP,   KC_PGDN
 | 
			
		||||
#define ____65_QWERTY______________ROW5    KC_LCTL, KC_LALT, KC_LGUI,                            KC_SPC,                    RAISE,   LOWER,   KC_CAPS, KC_LEFT, KC_DOWN, KC_RGHT
 | 
			
		||||
 | 
			
		||||
/* _RAISE
 | 
			
		||||
 * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┬───┐
 | 
			
		||||
 * │ ` │ ‽ │ ⸮ │   │ ¢ │   │   │   │★  │   │ ☻ │  ⃠ │CSH│  Del  │Hme│
 | 
			
		||||
 * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┼───┤
 | 
			
		||||
 * │     │   │WAT│ ∃ │Rup│TAD│YUN│   │ ∈ │ ॐ │   │♩ ♪│♫ ♬│     │Ins│
 | 
			
		||||
 * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┼───┤
 | 
			
		||||
 * │      │ ∀ │ ſ │ ⚂ │FRT│   │HUG│JOY│KSS│LOD│   │NO!│ ✓  💯  │End│
 | 
			
		||||
 * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┬───┼───┤
 | 
			
		||||
 * │ RShift │⚠ ☭│ ✖ │CAT│BOW│BUG│ № │MUS│DNC│ ⊢ │SHR│   McL│M↑ │McR│
 | 
			
		||||
 * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴──┬┴──┬┴──┬───┼───┼───┤
 | 
			
		||||
 * │RCtl│RAlt│RGui│          FLIP          │   │   │   │M← │M↓ │M→ │
 | 
			
		||||
 * └────┴────┴────┴────────────────────────┴───┴───┴───┴───┴───┴───┘
 | 
			
		||||
 */
 | 
			
		||||
#define ____65_RAISE_______________ROW1    KC_GRV,  X(IBNG), X(IRNY), _______, X(CENT), _______, _______, _______, STARS,   _______, SMILE,   X(NEG),  CSHAPES, KC_DEL,  KC_HOME
 | 
			
		||||
#define ____65_RAISE_______________ROW2    _______, _______, WAT,     X(LEXI), RUPA,    TADA,    YUNO,    _______, X(LELM), X(OM),   _______, MUSIC_A, MUSIC_B, _______, KC_INS
 | 
			
		||||
#define ____65_RAISE_______________ROW3    _______, X(LALL), X(EFF),  DICE,    FART,    _______, HUGS,    JOY,     KISS,    LOD,     _______, NOPENAH,          YEPYEP,  KC_END
 | 
			
		||||
#define ____65_RAISE_______________ROW4    OS_RSFT,          CUIDADO, X(ECKS), CATS,    DOMO,    BUGS,    X(NUM),  MUSIC,   DANCE,   X(LPRO), SHRUG,   KC_BTN1, KC_MS_U, KC_BTN2
 | 
			
		||||
#define ____65_RAISE_______________ROW5    OS_RCTL, OS_RALT, OS_RGUI,                            FLIP,                      _______, _______, _______, KC_MS_L, KC_MS_D, KC_MS_R
 | 
			
		||||
 | 
			
		||||
/* _LOWER
 | 
			
		||||
 * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┬───┐
 | 
			
		||||
 * │   │   │   │   │   │   │   │   │   │   │   │   │zzz│       │   │
 | 
			
		||||
 * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┼───┤
 | 
			
		||||
 * │     │u_f│u_i│u_m│u_n│usi│usn│u_s│   │   │PRT│   │   │     │   │
 | 
			
		||||
 * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┼───┤
 | 
			
		||||
 * │      │   │SLK│PAU│   │   │   │   │   │   │   │   │        │   │
 | 
			
		||||
 * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┬───┼───┤
 | 
			
		||||
 * │        │ZAL│   │CAP│VSN│   │NLK│   │   │   │   │      │   │   │
 | 
			
		||||
 * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴──┬┴──┬┴──┬───┼───┼───┤
 | 
			
		||||
 * │    │    │    │                        │   │   │   │ ← │ ↓ │ → │
 | 
			
		||||
 * └────┴────┴────┴────────────────────────┴───┴───┴───┴───┴───┴───┘
 | 
			
		||||
 */
 | 
			
		||||
#define ____65_LOWER_______________ROW1    _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ZZZZZ,   _______, _______
 | 
			
		||||
#define ____65_LOWER_______________ROW2    _______, U_FRACT, U_ITALI, U_MONOS, U_NORML, U_SANSI, U_SANSN, U_SCRPT, _______, _______, KC_PSCR, _______, _______, _______, _______
 | 
			
		||||
#define ____65_LOWER_______________ROW3    _______, _______, KC_SLCK, KC_PAUS, _______, _______, _______, _______, _______, _______, _______, _______,          _______, _______
 | 
			
		||||
#define ____65_LOWER_______________ROW4    _______,          ZALGO  , _______, KC_CAPS, VRSN,    _______, KC_NLCK, _______, _______, _______, _______, _______, _______, _______
 | 
			
		||||
#define ____65_LOWER_______________ROW5    _______, _______, _______,                            _______,                   _______, _______, _______, _______, _______, _______
 | 
			
		||||
 | 
			
		||||
/* _ADJUST
 | 
			
		||||
 * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┬───┐
 | 
			
		||||
 * │   │F1 │F2 │F3 │F4 │F5 │F6 │F7 │F8 │F9 │F10│F11│F12│       │   │
 | 
			
		||||
 * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┼───┤
 | 
			
		||||
 * │     │r x│r m│rh+│rh-│rs+│rs-│rv+│rv-│ra+│ra-│   │   │RESET│   │
 | 
			
		||||
 * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┼───┤
 | 
			
		||||
 * │      │   │   │   │   │   │   │   │   │   │   │   │EEP RSET│   │
 | 
			
		||||
 * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┬───┼───┤
 | 
			
		||||
 * │        │   │   │   │   │   │   │Mut│V- │V+ │   │U MODE│   │   │
 | 
			
		||||
 * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴──┬┴──┬┴──┬───┼───┼───┤
 | 
			
		||||
 * │    │    │    │                        │   │   │   │   │   │   │
 | 
			
		||||
 * └────┴────┴────┴────────────────────────┴───┴───┴───┴───┴───┴───┘
 | 
			
		||||
 */
 | 
			
		||||
#define ____65_ADJUST______________ROW1    _______, KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_F5,   KC_F6,   KC_F7,   KC_F8,   KC_F9,   KC_F10,  KC_F11,  KC_F12,  _______, _______
 | 
			
		||||
#define ____65_ADJUST______________ROW2    _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RESET,   _______
 | 
			
		||||
#define ____65_ADJUST______________ROW3    _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          EEP_RST, _______
 | 
			
		||||
#define ____65_ADJUST______________ROW4    _______,          _______, _______, _______, _______, _______, _______, KC_MUTE, KC_VOLD, KC_VOLU, _______, UC_MOD,  _______, _______
 | 
			
		||||
#define ____65_ADJUST______________ROW5    _______, _______, _______,                            _______,                   _______, _______, _______, _______, _______, _______
 | 
			
		||||
 | 
			
		||||
#define ____65_ADJUST__________RGB_ROW2    _______, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, RGB_SPI, RGB_SPD, _______, _______, RESET,   _______
 | 
			
		||||
#define ____65_ADJUST__________RGB_ROW3    _______, RGB_M_P, RGB_M_B, _______, _______, _______, _______, _______, _______, _______, _______, _______,          EEP_RST, _______
 | 
			
		||||
 | 
			
		||||
#define ____65_ADJUST___________BL_ROW2    _______, BL_TOGG, BL_BRTG, BL_STEP, _______, _______, _______, _______, _______, _______, _______, _______, _______, RESET,   _______
 | 
			
		||||
 | 
			
		||||
// clang-format on
 | 
			
		||||
| 
						 | 
				
			
			@ -1,5 +1,19 @@
 | 
			
		|||
#ifndef USERSPACE_CONFIG_H
 | 
			
		||||
#define USERSPACE_CONFIG_H
 | 
			
		||||
/* Copyright 2020 Joseph Wasson
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 2 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#define PERMISSIVE_HOLD
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -9,4 +23,5 @@
 | 
			
		|||
#define BOOTMAGIC_KEY_SKIP KC_I
 | 
			
		||||
#define BOOTMAGIC_KEY_EEPROM_CLEAR KC_E
 | 
			
		||||
 | 
			
		||||
#endif // !USERSPACE_CONFIG_H
 | 
			
		||||
#define COMBO_COUNT 2
 | 
			
		||||
#define COMBO_TERM 250
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										40
									
								
								users/talljoe/macros.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								users/talljoe/macros.c
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,40 @@
 | 
			
		|||
/* Copyright 2020 Joseph Wasson
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 2 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
#include "talljoe.h"
 | 
			
		||||
 | 
			
		||||
extern keymap_config_t keymap_config;
 | 
			
		||||
 | 
			
		||||
ostype_t get_os() {
 | 
			
		||||
  if(keymap_config.swap_lalt_lgui) {
 | 
			
		||||
    return MACOSX;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  return WINDOWS;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#define IS_OSX() (get_os() == MACOSX)
 | 
			
		||||
 | 
			
		||||
#define MOD_SEND(KEY) (IS_OSX() ? SEND_STRING(SS_LCMD(KEY)) : SEND_STRING(SS_LCTRL(KEY)))
 | 
			
		||||
 | 
			
		||||
void macro_copy() { MOD_SEND("c"); }
 | 
			
		||||
void macro_paste() { MOD_SEND("v"); }
 | 
			
		||||
void macro_lock() {
 | 
			
		||||
  if (IS_OSX()) {
 | 
			
		||||
    SEND_STRING(SS_LCTRL(SS_LCMD("q")));
 | 
			
		||||
  } else {
 | 
			
		||||
    SEND_STRING(SS_LGUI("l"));
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										27
									
								
								users/talljoe/macros.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								users/talljoe/macros.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,27 @@
 | 
			
		|||
/* Copyright 2020 Joseph Wasson
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 2 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
typedef enum OSTYPE {
 | 
			
		||||
  WINDOWS,
 | 
			
		||||
  MACOSX,
 | 
			
		||||
  LINUX
 | 
			
		||||
} ostype_t;
 | 
			
		||||
 | 
			
		||||
ostype_t get_os(void);
 | 
			
		||||
 | 
			
		||||
void macro_copy(void);
 | 
			
		||||
void macro_paste(void);
 | 
			
		||||
void macro_lock(void);
 | 
			
		||||
| 
						 | 
				
			
			@ -1,4 +1,11 @@
 | 
			
		|||
SRC += talljoe.c tapdance.c
 | 
			
		||||
SRC += talljoe.c macros.c $(wildcard users/talljoe/tapdance/*.c)
 | 
			
		||||
ifeq ($(strip $(VISUALIZER_ENABLE)), yes)
 | 
			
		||||
  SRC += visualizer.c
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(strip $(FLASH_BOOTLOADER)), yes)
 | 
			
		||||
    OPT_DEFS += -DFLASH_BOOTLOADER
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
EXTRAFLAGS+=-flto
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,3 +1,18 @@
 | 
			
		|||
/* Copyright 2020 Joseph Wasson
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 2 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
#include QMK_KEYBOARD_H
 | 
			
		||||
 | 
			
		||||
#include "talljoe.h"
 | 
			
		||||
| 
						 | 
				
			
			@ -5,14 +20,31 @@
 | 
			
		|||
#include "../../../keyboards/wilba_tech/wt_rgb_backlight.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef VISUALIZER_ENABLE
 | 
			
		||||
const char layer_names[32][16] = {
 | 
			
		||||
  [_BASE] = "QWERTY",
 | 
			
		||||
  [_WORKMAN] = "Workman",
 | 
			
		||||
  [_NORMAN] = "Norman",
 | 
			
		||||
  [_DVORAK] = "Dvorak",
 | 
			
		||||
  [_COLMAK] = "Colmak",
 | 
			
		||||
  [_MALTROFF] = "Maltroff",
 | 
			
		||||
  [_NORTRON] = "Nortron",
 | 
			
		||||
  [_GAME] = "Game",
 | 
			
		||||
  [_NAV] = "Navigation",
 | 
			
		||||
  [_NUM] = "Numpad",
 | 
			
		||||
  [_ADJUST] = "Adjust",
 | 
			
		||||
  [_RESET] = "Reset",
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
 | 
			
		||||
  [_BASE] = TEMPLATE_TKL(
 | 
			
		||||
      KC_ESC,  KC_F1  , KC_F2  , KC_F3  , KC_F4  , KC_F5  , KC_F6  , KC_F7  , KC_F8  , KC_F9  , KC_F10 , KC_F11 , KC_F12 ,          KC_PSCR, KC_SLCK, MO_ADJ ,
 | 
			
		||||
      US_LOCK, KC_F1  , KC_F2  , KC_F3  , KC_F4  , KC_F5  , KC_F6  , KC_F7  , KC_F8  , KC_F9  , KC_F10 , KC_F11 , KC_F12 ,          KC_PSCR, KC_SLCK, MO_ADJ ,
 | 
			
		||||
      US_GRV , KC_1   , KC_2   , KC_3   , KC_4   , KC_5   , KC_6   , KC_7   , KC_8   , KC_9   , KC_0   , KC_MINS, KC_EQL , US_BSLS, KC_INS , KC_HOME, KC_PGUP,
 | 
			
		||||
      US_TAB , KC_Q,    KC_W,    KC_E,    KC_R,    KC_T   , KC_Y,    KC_U,    KC_I,    KC_O,    KC_P   , KC_LBRC, KC_RBRC, KC_BSPC, KC_DEL , KC_END , KC_PGDN,
 | 
			
		||||
      CTL_ESC, KC_A,    KC_S,    KC_D,    KC_F,    KC_G   , KC_H,    KC_J,    KC_K,    KC_L,    US_SCLN, KC_QUOT,          US_ENT ,
 | 
			
		||||
      SH_LBRC, KC_Z,    KC_X,    KC_C,    KC_V,    KC_B   , KC_N,    KC_M,    KC_COMM, KC_DOT,  KC_SLSH,                   SH_RBRC,          KC_UP  ,
 | 
			
		||||
      KC_LCTL, KC_LGUI, KC_LALT,                   KC_SPC2, KC_SPC1, KC_SPC3,                   KC_RALT, KC_RGUI, KC_RCTL, KC_PTT , KC_LEFT, KC_DOWN, KC_RGHT),
 | 
			
		||||
      KC_LCTL, KC_LGUI, KC_LALT,                   KC_SPC2, KC_SPC3, KC_SPC1,                   KC_RALT, KC_RGUI, KC_RCTL, KC_PTT , KC_LEFT, KC_DOWN, KC_RGHT),
 | 
			
		||||
  [_WORKMAN] = TEMPLATE(
 | 
			
		||||
      _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
 | 
			
		||||
      _______, KC_Q   , KC_D   , KC_R   , KC_W   , KC_B   , KC_J   , KC_F   , KC_U   , KC_P   , US_SCLN, _______, _______, _______,
 | 
			
		||||
| 
						 | 
				
			
			@ -42,9 +74,16 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
 | 
			
		|||
  [_MALTROFF] = TEMPLATE(
 | 
			
		||||
      _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
 | 
			
		||||
      _______, KC_Q,    KC_P,    KC_Y,    KC_G,    KC_B   , KC_J,    KC_M,    KC_U,    KC_K,    KC_L,    _______, _______, _______,
 | 
			
		||||
      _______, KC_A,    KC_N,    KC_I,    KC_S,    KC_F   , KC_D,    KC_T,    KC_H,    KC_O,    KC_R   , US_ENT ,          KC_BSPC,
 | 
			
		||||
      _______, KC_Z,    KC_X,    KC_C,    KC_V,    US_QUOT, KC_SCLN, KC_W,    KC_COMM, KC_DOT,  KC_SLSH,          _______, _______,
 | 
			
		||||
      _______, KC_A,    KC_N,    KC_I,    KC_S,    KC_F   , KC_D,    KC_T,    KC_H,    KC_O,    KC_R   , _______,          _______,
 | 
			
		||||
      _______, KC_Z,    KC_X,    KC_C,    KC_V,    KC_SCLN, KC_BSPC, KC_W,    KC_COMM, KC_DOT,  KC_SLSH,          _______, _______,
 | 
			
		||||
      _______, _______, _______,                   MLT_E  , _______, _______,                   _______, _______, _______, _______),
 | 
			
		||||
  // It's Norman but like Maltron
 | 
			
		||||
  [_NORTRON] = TEMPLATE(
 | 
			
		||||
      _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
 | 
			
		||||
      _______, KC_Q   , KC_W   , KC_D   , KC_F   , KC_K   , KC_J   , KC_U   , KC_BSPC, KC_L   , US_SCLN, _______, _______, _______,
 | 
			
		||||
      _______, KC_A   , KC_S   , KC_I   , KC_T   , KC_G   , KC_Y   , KC_N   , KC_R   , KC_O   , KC_H   , _______,          _______,
 | 
			
		||||
      _______, KC_Z   , KC_X   , KC_C   , KC_V   , KC_B   , KC_P   , KC_M   , KC_COMM, KC_DOT , KC_SLSH,          _______, _______,
 | 
			
		||||
      _______, _______, _______,                   MLT_E  , US_ENT , _______,                   _______, _______, _______, _______),
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef ENABLE_GAME_LAYER
 | 
			
		||||
  [_GAME] = TEMPLATE(
 | 
			
		||||
| 
						 | 
				
			
			@ -57,27 +96,33 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
 | 
			
		|||
  [_NAV] = TEMPLATE_NAV(
 | 
			
		||||
      KC_GRV , KC_F1  , KC_F2  , KC_F3  , KC_F4  , KC_F5  , KC_F6  , KC_F7  , KC_F8  , KC_F9  , KC_F10 , KC_F11 , KC_F12 , XXXXXXX, XXXXXXX,
 | 
			
		||||
      US_TAB , KC_EXLM, KC_AT  , KC_HASH, KC_DLR , KC_PERC, KC_INS , KC_PGUP, KC_UP  , KC_PGDN, KC_BTN1, KC_BTN3, KC_BTN2, KC_DEL ,
 | 
			
		||||
      CTL_ESC, KC_LCBR, KC_RCBR, KC_LPRN, KC_RPRN, KC_AMPR, KC_HOME, KC_LEFT, KC_DOWN, KC_RGHT, KC_END , US_QUOT,          TG_ADJ ,
 | 
			
		||||
      CTL_ESC, KC_LCBR, KC_RCBR, KC_LPRN, KC_RPRN, KC_AMPR, KC_HOME, KC_LEFT, KC_DOWN, KC_RGHT, KC_END , KC_BSPC,          TG_ADJ ,
 | 
			
		||||
      KC_LSFT, KC_EQL,  KC_PLUS, KC_MINS, KC_UNDS, KC_ASTR, KC_CALC, US_GRV , KC_WBAK, KC_WFWD, KC_WREF,          KC_RSFT, KC_APP ,
 | 
			
		||||
      KC_LCTL, KC_LGUI, KC_LALT,                   NV_SPC2, NV_SPC1, NV_SPC3,                   KC_RALT, KC_RGUI, KC_RCTL, KC_PTT ),
 | 
			
		||||
      KC_LCTL, KC_LGUI, KC_LALT,                   NV_SPC2, NV_SPC3, NV_SPC1,                   KC_RALT, KC_RGUI, KC_RCTL, KC_PTT ),
 | 
			
		||||
  [_NUM] = TEMPLATE_NUM(
 | 
			
		||||
      XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
 | 
			
		||||
      KC_GRV , KC_F1  , KC_F2  , KC_F3  , KC_F4  , KC_VOLU, KC_CIRC, KC_7,    KC_8,    KC_9,    KC_PMNS, XXXXXXX, XXXXXXX, KC_DEL ,
 | 
			
		||||
      CTL_ESC, KC_F5  , KC_F6  , KC_F7  , KC_F8  , KC_MUTE, KC_PENT, KC_4,    KC_5,    KC_6,    KC_PPLS, XXXXXXX,          KC_ENT ,
 | 
			
		||||
      CTL_ESC, KC_F5  , KC_F6  , KC_F7  , KC_F8  , KC_MUTE, KC_PENT, KC_4,    KC_5,    KC_6,    KC_PPLS, KC_BSPC,          KC_ENT ,
 | 
			
		||||
      KC_LSFT, KC_F9  , KC_F10 , KC_F11 , KC_F12 , KC_VOLD, KC_PIPE, KC_1,    KC_2,    KC_3,    KC_PAST,          KC_PSLS, TG_NUM ,
 | 
			
		||||
      KC_LCTL, KC_LGUI, KC_LALT,                   NM_SPC2, NM_SPC1, NM_SPC3,                   KC_PDOT, KC_PCMM, KC_RCTL, KC_PTT ),
 | 
			
		||||
      KC_LCTL, KC_LGUI, KC_LALT,                   NM_SPC2, NM_SPC3, NM_SPC1,                   KC_PDOT, KC_PCMM, KC_RCTL, KC_PTT ),
 | 
			
		||||
 // Adjust layer is on the split-shift key; or NAV+Enter (for non-split keyboards)
 | 
			
		||||
  [_ADJUST] = TEMPLATE_ADJUST(
 | 
			
		||||
      MO_RST , FX(1)  , FX(2)  , FX(3)  , FX(4)  , FX(5)  , FX(6)  , FX(7)  , FX(8) ,  FX(9) ,  FX(10) , BR_DEC , BR_INC , XXXXXXX, MO_RST ,
 | 
			
		||||
      MO_RST , H1_INC , S1_INC , H2_INC , S2_INC , EF_INC , RGB_HUI, RGB_SAI, RGB_MOD, RGB_M_P, DFAULTS, RGB_VAD, RGB_VAI, MO_RST ,
 | 
			
		||||
      XXXXXXX, H1_DEC , S1_DEC , H2_DEC , S2_DEC , EF_DEC , RGB_HUD, RGB_SAD, RGB_RMOD,RGB_M_K, RGB_M_B, RGB_M_G,          TG_ADJ ,
 | 
			
		||||
      TG_NKRO, LY_QWER, LY_WORK, LY_NRMN, LY_DVRK, LY_CLMK, XXXXXXX, LY_MALT, XXXXXXX, XXXXXXX, KC_MAKE,          KC_CAPS, XXXXXXX,
 | 
			
		||||
      MO_RST , AG_SWAP, AG_NORM,                   XXXXXXX, BL_TOGG, XXXXXXX,                   RGB_TOG, XXXXXXX, XXXXXXX, TG_GAME),
 | 
			
		||||
      TG_NKRO, LY_QWER, LY_WORK, LY_CLMK, LY_DVRK, LY_NTRN, LY_NRMN, LY_MALT, XXXXXXX, XXXXXXX, KC_MAKE,          KC_CAPS, XXXXXXX,
 | 
			
		||||
      MO_RST , AG_SWAP, AG_NORM,                   XXXXXXX, XXXXXXX, BL_TOGG,                   RGB_TOG, XXXXXXX, XXXXXXX, TG_GAME),
 | 
			
		||||
  // To Reset hit FN + ` + Esc
 | 
			
		||||
  [_RESET] = TEMPLATE_RESET,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
__attribute__((weak))
 | 
			
		||||
void matrix_scan_keymap(void) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void matrix_scan_user(void) {
 | 
			
		||||
  matrix_scan_keymap();
 | 
			
		||||
 | 
			
		||||
  #ifdef KEYBOARD_gh60
 | 
			
		||||
    if (IS_LAYER_ON(_GAME)) {
 | 
			
		||||
      gh60_wasd_leds_on();
 | 
			
		||||
| 
						 | 
				
			
			@ -140,16 +185,21 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
 | 
			
		|||
  switch (keycode) {
 | 
			
		||||
    case KC_MAKE:  // Compiles the firmware, and adds the flash command based on keyboard bootloader
 | 
			
		||||
      if (!record->event.pressed) {
 | 
			
		||||
        SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP
 | 
			
		||||
 | 
			
		||||
  #if   defined(BOOTLOADER_HALFKAY)
 | 
			
		||||
                    ":teensy"
 | 
			
		||||
  #elif defined(BOOTLOADER_CATERINA)
 | 
			
		||||
                    ":avrdude"
 | 
			
		||||
  #else
 | 
			
		||||
                    ":dfu"
 | 
			
		||||
  #endif
 | 
			
		||||
                    SS_TAP(X_ENTER));
 | 
			
		||||
          uint8_t temp_mod = get_mods();
 | 
			
		||||
          uint8_t temp_osm = get_oneshot_mods();
 | 
			
		||||
          clear_mods(); clear_oneshot_mods();
 | 
			
		||||
          SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP);
 | 
			
		||||
#ifndef FLASH_BOOTLOADER
 | 
			
		||||
          if ((temp_mod | temp_osm) & MOD_MASK_SHIFT)
 | 
			
		||||
#endif
 | 
			
		||||
          {
 | 
			
		||||
              SEND_STRING(":flash");
 | 
			
		||||
          }
 | 
			
		||||
          if ((temp_mod | temp_osm) & MOD_MASK_CTRL) {
 | 
			
		||||
              SEND_STRING(" -j8 --output-sync");
 | 
			
		||||
          }
 | 
			
		||||
          tap_code(KC_ENT);
 | 
			
		||||
          set_mods(temp_mod);
 | 
			
		||||
      }
 | 
			
		||||
      return false;
 | 
			
		||||
      break;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,7 +1,24 @@
 | 
			
		|||
#ifndef USERSPACE
 | 
			
		||||
#define USERSPACE
 | 
			
		||||
/* Copyright 2020 Joseph Wasson
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 2 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "quantum.h"
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include QMK_KEYBOARD_H
 | 
			
		||||
#include "tapdance/tapdance.h"
 | 
			
		||||
#include "macros.h"
 | 
			
		||||
 | 
			
		||||
enum userspace_custom_keycodes {
 | 
			
		||||
  KC_MAKE = SAFE_RANGE, // can always be here
 | 
			
		||||
| 
						 | 
				
			
			@ -22,6 +39,7 @@ enum layers {
 | 
			
		|||
    _DVORAK,
 | 
			
		||||
    _COLMAK,
 | 
			
		||||
    _MALTROFF,
 | 
			
		||||
    _NORTRON,
 | 
			
		||||
    _GAME,
 | 
			
		||||
    _NAV,
 | 
			
		||||
    _NUM,
 | 
			
		||||
| 
						 | 
				
			
			@ -29,14 +47,12 @@ enum layers {
 | 
			
		|||
    _RESET = RESET_LAYER,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
enum tap_dancers {
 | 
			
		||||
  TD_SEMICOLON,
 | 
			
		||||
  TD_GRAVE,
 | 
			
		||||
  TD_QUOTE,
 | 
			
		||||
};
 | 
			
		||||
#ifdef VISUALIZER_ENABLE
 | 
			
		||||
  extern const char layer_names[][16];
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#define MO_NAV    MO(_NAV)
 | 
			
		||||
#define MO_ADJ    MO(_ADJUST)
 | 
			
		||||
#define MO_ADJ    TD(TD_FUNCTION)
 | 
			
		||||
#define MO_RST    MO(_RESET)
 | 
			
		||||
#define TG_ADJ    TG(_ADJUST)
 | 
			
		||||
#define TG_NUM    TG(_NUM)
 | 
			
		||||
| 
						 | 
				
			
			@ -52,8 +68,10 @@ enum tap_dancers {
 | 
			
		|||
#define LY_CLMK   DF(_COLMAK)
 | 
			
		||||
#if SPACE_COUNT >= 2
 | 
			
		||||
  #define LY_MALT DF(_MALTROFF)
 | 
			
		||||
  #define LY_NTRN DF(_NORTRON)
 | 
			
		||||
#else
 | 
			
		||||
  #define LY_MALT KC_NO
 | 
			
		||||
  #define LY_NTRN KC_NO
 | 
			
		||||
#endif
 | 
			
		||||
#define TG_NKRO   MAGIC_TOGGLE_NKRO
 | 
			
		||||
#define KC_PTT    KC_F24
 | 
			
		||||
| 
						 | 
				
			
			@ -66,60 +84,28 @@ enum tap_dancers {
 | 
			
		|||
#define US_BSLS   LCA_T(KC_BSLS)
 | 
			
		||||
#define US_SCLN   TD(TD_SEMICOLON)
 | 
			
		||||
#define US_GRV    TD(TD_GRAVE)
 | 
			
		||||
#define US_QUOT   TD(TD_QUOTE)
 | 
			
		||||
#define US_TAB    C_S_T(KC_TAB)
 | 
			
		||||
#define SH_LBRC   LSFT_T(KC_LBRC)
 | 
			
		||||
#define SH_RBRC   RSFT_T(KC_RBRC)
 | 
			
		||||
#define US_LOCK   TD(TD_LOCK)
 | 
			
		||||
 | 
			
		||||
#define MLT_E     LT(_NUM, KC_E)
 | 
			
		||||
 | 
			
		||||
#ifndef SPACE_COUNT
 | 
			
		||||
  #define SPACE_COUNT 1
 | 
			
		||||
#ifndef SWAP_HANDS_ENABLE
 | 
			
		||||
#define SH_T
 | 
			
		||||
#endif
 | 
			
		||||
#if (SPACE_COUNT == 1)
 | 
			
		||||
  #define KC_SPC1   LT(_NAV, KC_SPC)
 | 
			
		||||
  #define KC_SPC2   XXXXXXX
 | 
			
		||||
  #define KC_SPC3   XXXXXXX
 | 
			
		||||
 | 
			
		||||
  #define NV_SPC1   _______
 | 
			
		||||
  #define NV_SPC2   _______
 | 
			
		||||
  #define NV_SPC3   _______
 | 
			
		||||
#define KC_SPC1   LT(_NAV,KC_SPC)
 | 
			
		||||
#define KC_SPC2   LT(_NUM,KC_ENT)
 | 
			
		||||
#define KC_SPC3   SH_T(KC_BSPC)
 | 
			
		||||
 | 
			
		||||
  #define NM_SPC1   _______
 | 
			
		||||
  #define NM_SPC2   _______
 | 
			
		||||
  #define NM_SPC3   _______
 | 
			
		||||
#elif (SPACE_COUNT == 2)
 | 
			
		||||
  #define KC_SPC1   LT(_NAV,KC_SPC)
 | 
			
		||||
  #define KC_SPC2   LT(_NUM,KC_ENT)
 | 
			
		||||
#define NV_SPC1   KC_SPC
 | 
			
		||||
#define NV_SPC2   KC_ENT
 | 
			
		||||
#define NV_SPC3   KC_SPC
 | 
			
		||||
 | 
			
		||||
  #define NV_SPC1   KC_SPC
 | 
			
		||||
  #define NV_SPC2   KC_ENT
 | 
			
		||||
 | 
			
		||||
  #define NM_SPC1   KC_0
 | 
			
		||||
  #define NM_SPC2   KC_SPC
 | 
			
		||||
 | 
			
		||||
  #define KC_SPC3   XXXXXXX
 | 
			
		||||
  #define NV_SPC3   XXXXXXX
 | 
			
		||||
  #define NM_SPC3   XXXXXXX
 | 
			
		||||
#elif (SPACE_COUNT == 3)
 | 
			
		||||
  #ifdef SWAP_HANDS_ENABLE
 | 
			
		||||
    #define KC_SPC1 SH_T(KC_BSPC)
 | 
			
		||||
  #else
 | 
			
		||||
    #define KC_SPC1 KC_BSPC
 | 
			
		||||
  #endif
 | 
			
		||||
  #define KC_SPC2   LT(_NUM,KC_ENT)
 | 
			
		||||
  #define KC_SPC3   LT(_NAV,KC_SPC)
 | 
			
		||||
 | 
			
		||||
  #define NV_SPC1   KC_SPC
 | 
			
		||||
  #define NV_SPC2   KC_ENT
 | 
			
		||||
  #define NV_SPC3   KC_SPC
 | 
			
		||||
 | 
			
		||||
  #define NM_SPC1   KC_SPC
 | 
			
		||||
  #define NM_SPC2   XXXXXXX
 | 
			
		||||
  #define NM_SPC3   KC_0
 | 
			
		||||
#else
 | 
			
		||||
  #error "Unsupported space count:" SPACE_COUNT
 | 
			
		||||
#endif
 | 
			
		||||
#define NM_SPC1   KC_0
 | 
			
		||||
#define NM_SPC2   XXXXXXX
 | 
			
		||||
#define NM_SPC3   KC_SPC
 | 
			
		||||
 | 
			
		||||
#ifndef ZEAL_RGB
 | 
			
		||||
  #define BR_INC KC_NO
 | 
			
		||||
| 
						 | 
				
			
			@ -195,5 +181,3 @@ enum tap_dancers {
 | 
			
		|||
      XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,          XXXXXXX, XXXXXXX,           \
 | 
			
		||||
      RESET  , XXXXXXX, XXXXXXX,                   XXXXXXX, RESET  , XXXXXXX,                   XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,146 +0,0 @@
 | 
			
		|||
//Tap Dance
 | 
			
		||||
#include "talljoe.h"
 | 
			
		||||
 | 
			
		||||
enum {
 | 
			
		||||
  SINGLE_TAP = 1,
 | 
			
		||||
  SINGLE_HOLD = 2,
 | 
			
		||||
  DOUBLE_TAP = 3,
 | 
			
		||||
  DOUBLE_HOLD = 4,
 | 
			
		||||
  DOUBLE_SINGLE_TAP = 5, //send two single taps
 | 
			
		||||
  TRIPLE_TAP = 6,
 | 
			
		||||
  TRIPLE_HOLD = 7,
 | 
			
		||||
  SPECIAL = 8
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static struct {
 | 
			
		||||
  int quote;
 | 
			
		||||
  int semicolon;
 | 
			
		||||
} tap_state = {0};
 | 
			
		||||
 | 
			
		||||
int cur_dance (qk_tap_dance_state_t *state) {
 | 
			
		||||
  if (state->count == 1) {
 | 
			
		||||
    //If count = 1, and it has been interrupted - it doesn't matter if it is pressed or not: Send SINGLE_TAP
 | 
			
		||||
    if (state->interrupted) {
 | 
			
		||||
      //     if (!state->pressed) return SINGLE_TAP;
 | 
			
		||||
      //need "permissive hold" here.
 | 
			
		||||
      //     else return SINGLE_HOLD;
 | 
			
		||||
      //If the interrupting key is released before the tap-dance key, then it is a single HOLD
 | 
			
		||||
      //However, if the tap-dance key is released first, then it is a single TAP
 | 
			
		||||
      //But how to get access to the state of the interrupting key????
 | 
			
		||||
      return SINGLE_TAP;
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
      if (!state->pressed) return SINGLE_TAP;
 | 
			
		||||
      else return SINGLE_HOLD;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  //If count = 2, and it has been interrupted - assume that user is trying to type the letter associated
 | 
			
		||||
  //with single tap.
 | 
			
		||||
  else if (state->count == 2) {
 | 
			
		||||
    if (state->interrupted) return DOUBLE_SINGLE_TAP;
 | 
			
		||||
    else if (state->pressed) return DOUBLE_HOLD;
 | 
			
		||||
    else return DOUBLE_TAP;
 | 
			
		||||
  }
 | 
			
		||||
  else if ((state->count == 3) && ((state->interrupted) || (!state->pressed))) return TRIPLE_TAP;
 | 
			
		||||
  else if (state->count == 3) return TRIPLE_HOLD;
 | 
			
		||||
  else return SPECIAL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int hold_cur_dance (qk_tap_dance_state_t *state) {
 | 
			
		||||
  if (state->count == 1) {
 | 
			
		||||
    if (state->interrupted) {
 | 
			
		||||
      if (!state->pressed) return SINGLE_TAP;
 | 
			
		||||
      else return SINGLE_HOLD;
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
      if (!state->pressed) return SINGLE_TAP;
 | 
			
		||||
      else return SINGLE_HOLD;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  //If count = 2, and it has been interrupted - assume that user is trying to type the letter associated
 | 
			
		||||
  //with single tap.
 | 
			
		||||
  else if (state->count == 2) {
 | 
			
		||||
    if (state->pressed) return DOUBLE_HOLD;
 | 
			
		||||
    else return DOUBLE_TAP;
 | 
			
		||||
  }
 | 
			
		||||
  else if (state->count == 3) {
 | 
			
		||||
    if (!state->pressed) return TRIPLE_TAP;
 | 
			
		||||
    else return TRIPLE_HOLD;
 | 
			
		||||
  }
 | 
			
		||||
  else return SPECIAL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Send semi-colon + enter on two taps
 | 
			
		||||
void tap_dance_semicolon_finished(qk_tap_dance_state_t *state, void *user_data) {
 | 
			
		||||
  tap_state.semicolon = hold_cur_dance(state);
 | 
			
		||||
  switch (tap_state.semicolon) {
 | 
			
		||||
    case SINGLE_TAP: case DOUBLE_HOLD: register_code(KC_SCLN); break;
 | 
			
		||||
    case SINGLE_HOLD: layer_on(_NUM); break;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void tap_dance_semicolon_reset(qk_tap_dance_state_t *state, void *user_data) {
 | 
			
		||||
  switch (tap_state.semicolon) {
 | 
			
		||||
    case SINGLE_TAP: case DOUBLE_HOLD: unregister_code(KC_SCLN); break;
 | 
			
		||||
    case DOUBLE_TAP: {
 | 
			
		||||
      if (get_mods()) {
 | 
			
		||||
        SEND_STRING(";;"); // send normal when mods are pressed
 | 
			
		||||
      }
 | 
			
		||||
      else {
 | 
			
		||||
        SEND_STRING(";\n");
 | 
			
		||||
      }
 | 
			
		||||
      break;
 | 
			
		||||
    }
 | 
			
		||||
    case TRIPLE_TAP: {
 | 
			
		||||
      SEND_STRING(";\n\n");
 | 
			
		||||
    }
 | 
			
		||||
    case SPECIAL: layer_invert(_NUM); break;
 | 
			
		||||
    case SINGLE_HOLD: layer_off(_NUM); break;
 | 
			
		||||
  }
 | 
			
		||||
  tap_state.semicolon = 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Send `. ~. ```
 | 
			
		||||
void tap_dance_grave_finished(qk_tap_dance_state_t *state, void *user_data) {
 | 
			
		||||
  switch(state->count) {
 | 
			
		||||
    case 1:
 | 
			
		||||
      SEND_STRING("`");
 | 
			
		||||
      break;
 | 
			
		||||
    case 2:
 | 
			
		||||
      SEND_STRING("~");
 | 
			
		||||
      break;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void tap_dance_grave_each(qk_tap_dance_state_t *state, void *user_data) {
 | 
			
		||||
  if(state->count == 3) {
 | 
			
		||||
    SEND_STRING("```");
 | 
			
		||||
  } else if (state->count > 3) {
 | 
			
		||||
    SEND_STRING("`");
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void tap_dance_quote_finished(qk_tap_dance_state_t *state, void *user_data) {
 | 
			
		||||
  tap_state.quote = hold_cur_dance(state);
 | 
			
		||||
  switch (tap_state.quote) {
 | 
			
		||||
    case SINGLE_TAP: case DOUBLE_HOLD: register_code(KC_QUOT); break;
 | 
			
		||||
    case SINGLE_HOLD: layer_on(_NAV); break;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void tap_dance_quote_reset(qk_tap_dance_state_t *state, void *user_data) {
 | 
			
		||||
  switch (tap_state.quote) {
 | 
			
		||||
    case SINGLE_TAP: case DOUBLE_HOLD: unregister_code(KC_QUOTE); break;
 | 
			
		||||
    case DOUBLE_TAP: SEND_STRING("\""); break;
 | 
			
		||||
    case TRIPLE_TAP: layer_invert(_NAV); break;
 | 
			
		||||
    case SINGLE_HOLD: layer_off(_NAV); break;
 | 
			
		||||
  }
 | 
			
		||||
  tap_state.quote = 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
qk_tap_dance_action_t tap_dance_actions[] = {
 | 
			
		||||
  [TD_SEMICOLON] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, tap_dance_semicolon_finished, tap_dance_semicolon_reset),
 | 
			
		||||
  [TD_GRAVE]     = ACTION_TAP_DANCE_FN_ADVANCED(tap_dance_grave_each, tap_dance_grave_finished, NULL),
 | 
			
		||||
  [TD_QUOTE]     = ACTION_TAP_DANCE_FN_ADVANCED(NULL, tap_dance_quote_finished, tap_dance_quote_reset),
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										35
									
								
								users/talljoe/tapdance/actions/td.function.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								users/talljoe/tapdance/actions/td.function.c
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,35 @@
 | 
			
		|||
/* Copyright 2020 Joseph Wasson
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 2 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
static struct {
 | 
			
		||||
  int state;
 | 
			
		||||
} function_state = {0};
 | 
			
		||||
 | 
			
		||||
// Send semi-colon + enter on two taps
 | 
			
		||||
void tap_dance_function_finished(qk_tap_dance_state_t *state, void *user_data) {
 | 
			
		||||
  function_state.state = hold_cur_dance(state);
 | 
			
		||||
  switch (function_state.state) {
 | 
			
		||||
    case SINGLE_HOLD: layer_on(_ADJUST); break;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void tap_dance_function_reset(qk_tap_dance_state_t *state, void *user_data) {
 | 
			
		||||
  switch (function_state.state) {
 | 
			
		||||
    case SPECIAL: reset_keyboard(); break;
 | 
			
		||||
    case SINGLE_HOLD: layer_off(_ADJUST); break;
 | 
			
		||||
  }
 | 
			
		||||
  function_state.state = 0;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										36
									
								
								users/talljoe/tapdance/actions/td.grave.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								users/talljoe/tapdance/actions/td.grave.c
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,36 @@
 | 
			
		|||
/* Copyright 2020 Joseph Wasson
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 2 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
// Send `. ~. ```
 | 
			
		||||
void tap_dance_grave_finished(qk_tap_dance_state_t *state, void *user_data) {
 | 
			
		||||
  switch(state->count) {
 | 
			
		||||
    case 1:
 | 
			
		||||
      SEND_STRING("`");
 | 
			
		||||
      break;
 | 
			
		||||
    case 2:
 | 
			
		||||
      SEND_STRING("~");
 | 
			
		||||
      break;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void tap_dance_grave_each(qk_tap_dance_state_t *state, void *user_data) {
 | 
			
		||||
  if(state->count == 3) {
 | 
			
		||||
    SEND_STRING("```");
 | 
			
		||||
  } else if (state->count > 3) {
 | 
			
		||||
    SEND_STRING("`");
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										35
									
								
								users/talljoe/tapdance/actions/td.lock.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								users/talljoe/tapdance/actions/td.lock.c
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,35 @@
 | 
			
		|||
/* Copyright 2020 Joseph Wasson
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 2 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
static struct {
 | 
			
		||||
  int state;
 | 
			
		||||
} lock_state = {0};
 | 
			
		||||
 | 
			
		||||
// Send semi-colon + enter on two taps
 | 
			
		||||
void tap_dance_lock_finished(qk_tap_dance_state_t *state, void *user_data) {
 | 
			
		||||
  lock_state.state = cur_dance(state);
 | 
			
		||||
  switch (lock_state.state) {
 | 
			
		||||
    case SINGLE_TAP: register_code(KC_ESC); break;
 | 
			
		||||
    case SINGLE_HOLD: macro_lock(); break;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void tap_dance_lock_reset(qk_tap_dance_state_t *state, void *user_data) {
 | 
			
		||||
  switch (lock_state.state) {
 | 
			
		||||
    case SINGLE_TAP: unregister_code(KC_ESC); break;
 | 
			
		||||
  }
 | 
			
		||||
  lock_state.state = 0;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										54
									
								
								users/talljoe/tapdance/actions/td.semicolon.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								users/talljoe/tapdance/actions/td.semicolon.c
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,54 @@
 | 
			
		|||
/* Copyright 2020 Joseph Wasson
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 2 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
static struct {
 | 
			
		||||
  int semicolon;
 | 
			
		||||
  bool mods;
 | 
			
		||||
} tap_state = {0};
 | 
			
		||||
 | 
			
		||||
void tap_dance_semicolon_each(qk_tap_dance_state_t *state, void *user_data) {
 | 
			
		||||
    tap_state.mods |= get_mods();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Send semi-colon + enter on two taps
 | 
			
		||||
void tap_dance_semicolon_finished(qk_tap_dance_state_t *state, void *user_data) {
 | 
			
		||||
  tap_state.semicolon = hold_cur_dance(state);
 | 
			
		||||
  switch (tap_state.semicolon) {
 | 
			
		||||
    case SINGLE_TAP: case DOUBLE_HOLD: register_code(KC_SCLN); break;
 | 
			
		||||
    case SINGLE_HOLD: layer_on(_NUM); break;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void tap_dance_semicolon_reset(qk_tap_dance_state_t *state, void *user_data) {
 | 
			
		||||
  switch (tap_state.semicolon) {
 | 
			
		||||
    case SINGLE_TAP: case DOUBLE_HOLD: unregister_code(KC_SCLN); break;
 | 
			
		||||
    case DOUBLE_TAP: {
 | 
			
		||||
      if (tap_state.mods) {
 | 
			
		||||
        SEND_STRING(";;"); // send normal when mods are pressed
 | 
			
		||||
      }
 | 
			
		||||
      else {
 | 
			
		||||
        SEND_STRING(";\n");
 | 
			
		||||
      }
 | 
			
		||||
      break;
 | 
			
		||||
    }
 | 
			
		||||
    case TRIPLE_TAP: {
 | 
			
		||||
      SEND_STRING(";\n\n");
 | 
			
		||||
    }
 | 
			
		||||
    case SPECIAL: layer_invert(_NUM); break;
 | 
			
		||||
    case SINGLE_HOLD: layer_off(_NUM); break;
 | 
			
		||||
  }
 | 
			
		||||
  tap_state.semicolon = 0;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										26
									
								
								users/talljoe/tapdance/tapdance.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								users/talljoe/tapdance/tapdance.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,26 @@
 | 
			
		|||
/* Copyright 2020 Joseph Wasson
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 2 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "quantum.h"
 | 
			
		||||
#include "td_setup.h"
 | 
			
		||||
 | 
			
		||||
enum tap_dancers {
 | 
			
		||||
  TD_SEMICOLON,
 | 
			
		||||
  TD_GRAVE,
 | 
			
		||||
  TD_LOCK,
 | 
			
		||||
  TD_FUNCTION,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										28
									
								
								users/talljoe/tapdance/tapdance_actions.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								users/talljoe/tapdance/tapdance_actions.c
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,28 @@
 | 
			
		|||
/* Copyright 2020 Joseph Wasson
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 2 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "../talljoe.h"
 | 
			
		||||
#include "actions/td.grave.c"
 | 
			
		||||
#include "actions/td.lock.c"
 | 
			
		||||
#include "actions/td.semicolon.c"
 | 
			
		||||
#include "actions/td.function.c"
 | 
			
		||||
 | 
			
		||||
qk_tap_dance_action_t tap_dance_actions[] = {
 | 
			
		||||
  [TD_SEMICOLON] = ACTION_TAP_DANCE_FN_ADVANCED(tap_dance_semicolon_each, tap_dance_semicolon_finished, tap_dance_semicolon_reset),
 | 
			
		||||
  [TD_LOCK]      = ACTION_TAP_DANCE_FN_ADVANCED(NULL, tap_dance_lock_finished, tap_dance_lock_reset),
 | 
			
		||||
  [TD_GRAVE]     = ACTION_TAP_DANCE_FN_ADVANCED(tap_dance_grave_each, tap_dance_grave_finished, NULL),
 | 
			
		||||
  [TD_FUNCTION]  = ACTION_TAP_DANCE_FN_ADVANCED(NULL, tap_dance_function_finished, tap_dance_function_reset),
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										70
									
								
								users/talljoe/tapdance/td_setup.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										70
									
								
								users/talljoe/tapdance/td_setup.c
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,70 @@
 | 
			
		|||
/* Copyright 2020 Joseph Wasson
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 2 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "tapdance.h"
 | 
			
		||||
 | 
			
		||||
int cur_dance (qk_tap_dance_state_t *state) {
 | 
			
		||||
  if (state->count == 1) {
 | 
			
		||||
    //If count = 1, and it has been interrupted - it doesn't matter if it is pressed or not: Send SINGLE_TAP
 | 
			
		||||
    if (state->interrupted) {
 | 
			
		||||
      //     if (!state->pressed) return SINGLE_TAP;
 | 
			
		||||
      //need "permissive hold" here.
 | 
			
		||||
      //     else return SINGLE_HOLD;
 | 
			
		||||
      //If the interrupting key is released before the tap-dance key, then it is a single HOLD
 | 
			
		||||
      //However, if the tap-dance key is released first, then it is a single TAP
 | 
			
		||||
      //But how to get access to the state of the interrupting key????
 | 
			
		||||
      return SINGLE_TAP;
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
      if (!state->pressed) return SINGLE_TAP;
 | 
			
		||||
      else return SINGLE_HOLD;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  //If count = 2, and it has been interrupted - assume that user is trying to type the letter associated
 | 
			
		||||
  //with single tap.
 | 
			
		||||
  else if (state->count == 2) {
 | 
			
		||||
    if (state->interrupted) return DOUBLE_SINGLE_TAP;
 | 
			
		||||
    else if (state->pressed) return DOUBLE_HOLD;
 | 
			
		||||
    else return DOUBLE_TAP;
 | 
			
		||||
  }
 | 
			
		||||
  else if ((state->count == 3) && ((state->interrupted) || (!state->pressed))) return TRIPLE_TAP;
 | 
			
		||||
  else if (state->count == 3) return TRIPLE_HOLD;
 | 
			
		||||
  else return SPECIAL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int hold_cur_dance (qk_tap_dance_state_t *state) {
 | 
			
		||||
  if (state->count == 1) {
 | 
			
		||||
    if (state->interrupted) {
 | 
			
		||||
      if (!state->pressed) return SINGLE_TAP;
 | 
			
		||||
      else return SINGLE_HOLD;
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
      if (!state->pressed) return SINGLE_TAP;
 | 
			
		||||
      else return SINGLE_HOLD;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  //If count = 2, and it has been interrupted - assume that user is trying to type the letter associated
 | 
			
		||||
  //with single tap.
 | 
			
		||||
  else if (state->count == 2) {
 | 
			
		||||
    if (state->pressed) return DOUBLE_HOLD;
 | 
			
		||||
    else return DOUBLE_TAP;
 | 
			
		||||
  }
 | 
			
		||||
  else if (state->count == 3) {
 | 
			
		||||
    if (!state->pressed) return TRIPLE_TAP;
 | 
			
		||||
    else return TRIPLE_HOLD;
 | 
			
		||||
  }
 | 
			
		||||
  else return SPECIAL;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										29
									
								
								users/talljoe/tapdance/td_setup.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								users/talljoe/tapdance/td_setup.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,29 @@
 | 
			
		|||
/* Copyright 2020 Joseph Wasson
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 2 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
enum {
 | 
			
		||||
  SINGLE_TAP = 1,
 | 
			
		||||
  SINGLE_HOLD = 2,
 | 
			
		||||
  DOUBLE_TAP = 3,
 | 
			
		||||
  DOUBLE_HOLD = 4,
 | 
			
		||||
  DOUBLE_SINGLE_TAP = 5, //send two single taps
 | 
			
		||||
  TRIPLE_TAP = 6,
 | 
			
		||||
  TRIPLE_HOLD = 7,
 | 
			
		||||
  SPECIAL = 8
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
int cur_dance (qk_tap_dance_state_t *state);
 | 
			
		||||
int hold_cur_dance (qk_tap_dance_state_t *state);
 | 
			
		||||
							
								
								
									
										21
									
								
								users/talljoe/visualizer.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								users/talljoe/visualizer.c
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,21 @@
 | 
			
		|||
/* Copyright 2020 Joseph Wasson
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 2 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "talljoe.h"
 | 
			
		||||
 | 
			
		||||
static void get_visualizer_layer_and_color(visualizer_state_t* state) {
 | 
			
		||||
  state->status_text = layer_names[biton32(state->status.layer)];
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue