Merge branch '24-move-universal-x-keybinds-from-i3-config-to-shxkd-bindings' into 'master'

Resolve "Move (universal) x Keybinds from i3 config to shxkd bindings"

Closes #24

See merge request marty-oehme/dotfiles!6
This commit is contained in:
Marty Oehme 2019-05-22 13:20:58 +00:00
commit 258df0ec04
4 changed files with 69 additions and 35 deletions

View file

@ -31,18 +31,8 @@ font $font
# Use Mouse+$mod to drag floating windows to their wanted position # Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod floating_modifier $mod
# start a terminal
bindsym $mod+Return exec alacritty #i3-sensible-terminal
# kill focused window # kill focused window
bindsym $mod+Shift+x kill bindsym $mod+Shift+c kill
# start dmenu (a program launcher)
#bindsym $mod+space exec dmenu_run
# There also is the (new) i3-dmenu-desktop which only displays applications
# shipping a .desktop file. It is a wrapper around dmenu, so you need that
# installed.
bindsym $mod+space exec --no-startup-id i3-dmenu-desktop
# change focus # change focus
bindsym $mod+h focus left bindsym $mod+h focus left
@ -174,36 +164,20 @@ bindsym $mod+r mode "resize"
# Start i3bar to display a workspace bar (plus the system information i3status # Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available) # finds out, if available)
bar { bar {
strip_workspace_numbers yes strip_workspace_numbers yes
font $font font $font
position bottom position bottom
colors { colors {
background #232323 background #232323
statusline #DCDCDC statusline #DCDCDC
} }
status_command i3status status_command i3status
} }
# I3 System commands: restart, reload, shutdown, lock
# reload the configuration file # reload the configuration file
bindsym $mod+Shift+y reload bindsym $mod+Shift+y reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3) # restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+r restart bindsym $mod+Shift+r restart
# exit i3 (logs you out of your X session)
bindsym $mod+Shift+s exec --no-startup-id `[ $(printf "NO\nYES" | dmenu \
-nb "#222222" -sb "#aa0088" -sf "#ffffff" -fn Monospace-11 \
-nf "#7777bb" -i -p "Exit i3 X session?") = "YES" ] && i3-msg exit`
# lock i3 screen
bindsym $mod+Shift+p exec i3lock
# enable function (/media) key functionality
# TODO: set up next song, previous song, pause, etc
# see: https://www.reddit.com/r/i3wm/comments/3a6nh3/help_how_to_use_function_keys_in_i3_config/
bindsym XF86MonBrightnessUp exec `xbacklight -inc 10`
bindsym XF86MonBrightnessDown exec `xbacklight -dec 10`
bindsym XF86AudioMute exec `pulsemixer --toggle-mute`
bindsym XF86AudioRaiseVolume exec `pulsemixer --change-volume +5`
bindsym XF86AudioLowerVolume exec `pulsemixer --change-volume -5`
# set a pretty wallpaper # set a pretty wallpaper
exec_always --no-startup-id feh --bg-scale ~/Pictures/wall.jpg exec_always --no-startup-id feh --bg-scale ~/pictures/wall.jpg

15
.config/scripts/bin/dmenuprompt Executable file
View file

@ -0,0 +1,15 @@
#!/bin/sh
# A dmenu binary prompt script.
# Gives a dmenu prompt labeled with $1 to perform command $2.
# For example:
# `./prompt "Do you want to shutdown?" "shutdown -h now"`
if [[ -z $3 ]] || [[ $3 == "normal" ]]; then
[ "$(printf "No\\nYes" | dmenu -i -p "$1")" = "Yes" ] && $2
elif [[ $3 == "success" ]]; then
[ "$(printf "No\\nYes" | dmenu -i -p "$1" -nb webgreen -sb greenyellow -sf black -nf white )" = "Yes" ] && $2
elif [[ $3 == "warn" ]] || [[ $3 == "warning" ]]; then
[ "$(printf "No\\nYes" | dmenu -i -p "$1" -nb goldenrod -sb gold -sf black -nf white )" = "Yes" ] && $2
elif [[ $3 == "danger" ]]; then
[ "$(printf "No\\nYes" | dmenu -i -p "$1" -nb darkred -sb red -sf white -nf gray )" = "Yes" ] && $2
fi

42
.config/sxhkd/sxhkdrc Normal file
View file

@ -0,0 +1,42 @@
# universal x key bindings
# Open terminal emulator (TODO find way to not hard-code alacritty, perhaps ENV vars)
mod4 + Return
exec alacritty
# open quick start menu
mod4 + space
exec i3-dmenu-desktop
# System functionality
# Enable lock screen (TODO does not stop music, etc yet
# see https://github.com/LukeSmithxyz/voidrice/blob/archi3/.config/sxhkd/sxhkdrc for that)
super + x
i3lock -e -f -c 1d2021
# Shut down system
super + shift + x
dmenuprompt "SHUT DOWN computer?" "sudo -A shutdown -h now" danger
# Exit X session
super + BackSpace
dmenuprompt "Log out of X Session?" "i3-msg exit" warn
# Restart system
super + shift + BackSpace
dmenuprompt "Reboot computer?" "sudo reboot" danger
# enable function (/media) key functionality
# TODO: set up next song, previous song, pause, etc
# see: https://www.reddit.com/r/i3wm/comments/3a6nh3/help_how_to_use_function_keys_in_i3_config/
XF86MonBrightnessUp
exec `xbacklight -inc 10`
XF86MonBrightnessDown
exec `xbacklight -dec 10`
XF86AudioMute
exec `pulsemixer --toggle-mute`
XF86AudioRaiseVolume
exec `pulsemixer --change-volume +5`
XF86AudioLowerVolume
exec `pulsemixer --change-volume -5`

View file

@ -55,6 +55,9 @@ type compton >/dev/null 2>&1 && compton &
# same deal with flashfocus as our active window indicator # same deal with flashfocus as our active window indicator
type flashfocus >/dev/null 2>&1 && flashfocus -l never & type flashfocus >/dev/null 2>&1 && flashfocus -l never &
# if sxhkd - the key-binding daemon is installed, start it up
type sxhkd >/dev/null 2>&1 && sxhkd &
# additional config options for Touchpad devices ONLY # additional config options for Touchpad devices ONLY
if [ $(dmesg | grep "Touchpad" | wc -l) > 0 ]; then if [ $(dmesg | grep "Touchpad" | wc -l) > 0 ]; then
# enable touch tapping for XPS13 touchpad - for different devices get the touchpad name with xinput list-prop <TAB> # enable touch tapping for XPS13 touchpad - for different devices get the touchpad name with xinput list-prop <TAB>