From 0e829a629c54228ee51bbc15bfe1bcc8f7927ecd Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Wed, 22 May 2019 13:30:01 +0200 Subject: [PATCH 1/7] Fix i3 config indentation --- .config/i3/config | 14 +++++++------- .config/sxhkd/sxhkdrc | 0 2 files changed, 7 insertions(+), 7 deletions(-) create mode 100644 .config/sxhkd/sxhkdrc diff --git a/.config/i3/config b/.config/i3/config index a44e762..fbb994f 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -174,14 +174,14 @@ bindsym $mod+r mode "resize" # Start i3bar to display a workspace bar (plus the system information i3status # finds out, if available) bar { - strip_workspace_numbers yes + strip_workspace_numbers yes font $font - position bottom - colors { - background #232323 - statusline #DCDCDC - } - status_command i3status + position bottom + colors { + background #232323 + statusline #DCDCDC + } + status_command i3status } # I3 System commands: restart, reload, shutdown, lock diff --git a/.config/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc new file mode 100644 index 0000000..e69de29 From 472b2e8f9255d5c8b17da02bf429539521f0d39f Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Wed, 22 May 2019 14:24:29 +0200 Subject: [PATCH 2/7] Add simple prompt program based on dmenu Can be used to as for confirmation for actions (E.g. shut down pc, reboot and so on). Takes 3 parameters, with the last being optional, in the form of: dmenuprompt "Text to display" "command to execute on yes" [success/warn/danger] The last flag only changes the colors being displayed by the prompt. If the last flag is not provided, it will display in default colors. --- .config/scripts/bin/dmenuprompt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 .config/scripts/bin/dmenuprompt diff --git a/.config/scripts/bin/dmenuprompt b/.config/scripts/bin/dmenuprompt new file mode 100755 index 0000000..4f5c025 --- /dev/null +++ b/.config/scripts/bin/dmenuprompt @@ -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 From bdbde11ef108cc660e056f491f71228d7e614888 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Wed, 22 May 2019 14:41:33 +0200 Subject: [PATCH 3/7] Add sxhkd key bindings file Added the key bindings from i3 to sxhkd, making use of the new dmenuprompt program. --- .config/sxhkd/sxhkdrc | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/.config/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc index e69de29..4c92fdf 100644 --- a/.config/sxhkd/sxhkdrc +++ b/.config/sxhkd/sxhkdrc @@ -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` From 844256901d48bec1290326321c98db1d1d35c616 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Wed, 22 May 2019 14:42:39 +0200 Subject: [PATCH 4/7] Remove duplicate keybindings from i3 config Removed the keybindings now handled by sxhkd. Some are changed around slightly, most of them are still the same. --- .config/i3/config | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/.config/i3/config b/.config/i3/config index fbb994f..3edd971 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -31,19 +31,9 @@ font $font # Use Mouse+$mod to drag floating windows to their wanted position floating_modifier $mod -# start a terminal -bindsym $mod+Return exec alacritty #i3-sensible-terminal - # kill focused window bindsym $mod+Shift+x 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 bindsym $mod+h focus left bindsym $mod+j focus down @@ -184,26 +174,10 @@ bar { status_command i3status } -# I3 System commands: restart, reload, shutdown, lock # reload the configuration file bindsym $mod+Shift+y reload # restart i3 inplace (preserves your layout/session, can be used to upgrade i3) 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 exec_always --no-startup-id feh --bg-scale ~/Pictures/wall.jpg From 1f491f8f2348ddbff84a90ac5c469caf95664318 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Wed, 22 May 2019 14:43:31 +0200 Subject: [PATCH 5/7] Fix background picture folder name in i3 config i3 was looking for the picture in Pictures, but it is spelled with a small p - pictures in my xdg dirs. --- .config/i3/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/i3/config b/.config/i3/config index 3edd971..def140c 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -180,4 +180,4 @@ bindsym $mod+Shift+y reload bindsym $mod+Shift+r restart # 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 From ccd25e65eac1db337379583766408f7171dad7f5 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Wed, 22 May 2019 14:46:48 +0200 Subject: [PATCH 6/7] set sxhkd to autostart on xinit Checks for existence of the program, and then starts it. Does nothing if sxhkd is not installed (fails silently). --- .xinitrc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.xinitrc b/.xinitrc index 852f9eb..d6fc84d 100644 --- a/.xinitrc +++ b/.xinitrc @@ -55,6 +55,9 @@ type compton >/dev/null 2>&1 && compton & # same deal with flashfocus as our active window indicator 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 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 From e28a068bb9a51f55f407114b54d7f10691cc20f2 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Wed, 22 May 2019 14:49:10 +0200 Subject: [PATCH 7/7] Fix duplicate i3 keybind close window Kill window in i3 shadows shutdown pc in x. This changes the close window key to be super+shift+c. --- .config/i3/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/i3/config b/.config/i3/config index def140c..b5ea3df 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -32,7 +32,7 @@ font $font floating_modifier $mod # kill focused window -bindsym $mod+Shift+x kill +bindsym $mod+Shift+c kill # change focus bindsym $mod+h focus left