Skip to content

Commit

Permalink
add default config file
Browse files Browse the repository at this point in the history
  • Loading branch information
ALEX11BR committed Dec 25, 2021
1 parent 71d9793 commit 12743a9
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 3 deletions.
13 changes: 11 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
BIN := gxhk
DESTDIR :=
PREFIX := /usr/local

.PHONY: build install
.PHONY: build clean install uninstall

build:
go build

clean:
go clean

install: $(BIN)
install -Dm755 $(BIN) $(PREFIX)/bin/$(BIN)
install -Dm755 $(BIN) $(DESTDIR)$(PREFIX)/bin/$(BIN)
install -Dm755 gxhkrc $(DESTDIR)/etc/gxhkrc

uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/$(BIN)
rm -f $(DESTDIR)/etc/gxhkrc
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ $ gxhk info # Let's see what happens now
On print press: Spawn 'maim ~/screenshot-$(date +%s).png && notify-send "Screenshot saved!"'
On mod4-shift-return release: Launch terminal
```

You can check the [`gxhkrc`](gxhkrc) file for more inspiration, or, once you've installed the app, just copy the default config file like this: `install -Dm755 /etc/gxhkrc ~/.config/gxhk/gxhkrc` and start editing.
## Installation
### From source
Run `make build` to build the app, then `sudo make install` to install it.
45 changes: 45 additions & 0 deletions gxhkrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env sh

## This is the default config file for gxhk.
## It is literally a shell script that will be executed by gxhk when it starts.

## Across this file we'll be using a mod key for our shortcuts.
## Mod4 (the Super/Windows/whatever key) is one of the most popular choices in this regard.
## Mod1 (the Alt key) can be a good alternative here if you need it
mod=mod4

## All the bindings proposed here will be commented with a single '#'
## They serve as a source of inspiration for those who haven't yet used such a
## keybinding program and a source of various examples of how to use this program.

## If you want to bind a key to a command, you do it like this:
## $ gxhk bind [KEY] [COMMAND] (DESCRIPTION)
## - KEY can be expresses e.g. 'mod4-a', 'mod4-shift-a', 'backslash', 'control-backslash' etc.
## Tip: if you're not sure about the name of a key, run 'xev' and press that key to see its name.
## - COMMAND is an sh command to be spawned whenever the KEY gets pressed,
## or released if the -r flag is passed right before the KEY.
## I recommend you to surround the COMMAND in apostrophes (') so that it doesn't get messed up.
## - DESCRIPTION is an optional human-readable description of the command.
## It is useful for the 'gxhk info' command which shows the descriptions (or a fallback which
## shows the commands themselves) of all the currently bound commands with their trigger keys.

## Presented below are some GENERAL COMMANDS:

## These two make the brightness keys do what they're supposed to do.
## For this to work, you need to install either xorg-xbacklight or acpilight.
#gxhk bind XF86MonBrightnessUp 'xbacklight -inc 5' 'Increase the screen brightness'
#gxhk bind XF86MonBrightnessDown 'xbacklight -dec 5' 'Decrease the screen brightness'

## This one opens the $TERMINAL when the chosen mod key and the Enter key are pressed together.
## It even uses 'xterm' as a backup if the $TERMINAL is not set.
#gxhk bind $mod-Return '${TERMINAL:-xterm}' 'Launch the terminal'

## This one binds the PrintScreen key to a command which saves a screenshot
## with a time-based file name and sends a notification if it gets saved succesfully
## For this to work, you need to instll maim and run in the background a notification daemon.
#gxhk bind Print 'maim ~/screenshot-$(date +%s).png && notify-send "Screenshot saved!"'

## This one opens an app menu when the chosen mod key and the d key get released together.
## so that all the other bindings which use this key won't be affected
## For this to work, you need to install rofi.
#gxhk bind -r $mod-d 'rofi -show drun -show-icons' 'Launch the app menu'

0 comments on commit 12743a9

Please sign in to comment.