Skip to content

Commit

Permalink
Adds systemd unit and deb package
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanprior committed Feb 16, 2017
1 parent b3d8909 commit cb8a846
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 22 deletions.
26 changes: 4 additions & 22 deletions _home_row_control
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/sh
### home row control: use big keys on the home row as ctrl modifiers

## Author: Ryan Prior <ryanprior@gmail.com>
Expand All @@ -7,24 +7,6 @@
## COPYING or https://creativecommons.org/publicdomain/zero/1.0/ for
## details.

function enter_acts_as_ctrl ()
{
xmodmap -e "remove mod4 = Hyper_L"
xmodmap -e "keycode 36 = Hyper_L"
xmodmap -e "add control = Hyper_L"
xmodmap -e "keycode any = Return"
}

function caps_acts_as_ctrl ()
{
xmodmap -e "remove lock = Caps_Lock"
xmodmap -e "keycode 66 = Control_R"
xmodmap -e "add control = Control_R"
xmodmap -e "keycode any = Caps_Lock"
}

(
enter_acts_as_ctrl
caps_acts_as_ctrl
xcape -e "Hyper_L=Return;Control_R=Caps_Lock"
) 2>&1 >/dev/null &
xmodmap /etc/home-row-control/maps/enter.map
xmodmap /etc/home-row-control/maps/caps.map
xcape -e "Hyper_L=Return;Control_R=Caps_Lock"
13 changes: 13 additions & 0 deletions home-row-control.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[Unit]
Description=using caps-lock and enter as extra ctrl modifiers
Documentation=https://github.com/ryanprior/home-row-control/blob/master/README.md

[Service]
Type=forking
Environment=DISPLAY=:0
ExecStart=/usr/local/bin/_home_row_control
Restart=always
RestartSec=5

[Install]
WantedBy=default.target
4 changes: 4 additions & 0 deletions maps/caps.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
remove lock = Caps_Lock
keycode 66 = Control_R
add control = Control_R
keycode any = Caps_Lock
4 changes: 4 additions & 0 deletions maps/enter.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
remove mod4 = Hyper_L
keycode 36 = Hyper_L
add control = Hyper_L
keycode any = Return
39 changes: 39 additions & 0 deletions package
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env bash

PACKAGE_NAME="home-row-control"
VERSION="0.1"

CONF_DIR=/etc/home-row-control
CONF=user.conf
CONF_TARGET=$CONF_DIR/$CONF

SCRIPT=_home_row_control
SCRIPT_TARGET=/usr/local/bin/$SCRIPT

CHANGELOG=CHANGELOG.md

DOC=README.md
DOC_TARGET=/usr/share/doc/home-row-control/$DOC

SERVICE=home-row-control.service
SERVICE_TARGET=/usr/lib/systemd/user/$SERVICE

set -x
fpm -s dir \
-t deb \
-n $PACKAGE_NAME \
-v $VERSION \
--license "CC-0" \
--maintainer "Ryan Prior <ryanprior@gmail.com>" \
--vendor "Ryan Prior" \
--description "Use big modifier keys in the home row for Ctrl" \
-a all \
--url "https://github.com/ryanprior/home-row-control" \
"-d "{xcape,x11-xserver-utils,coreutils,dash} \
--config-files $CONF_DIR \
--deb-changelog $CHANGELOG \
--deb-no-default-config-files \
$SCRIPT=$SCRIPT_TARGET \
$DOC=$DOC_TARGET \
$SERVICE=$SERVICE_TARGET \
maps=$CONF_DIR

0 comments on commit cb8a846

Please sign in to comment.