Skip to content

Instantly share code, notes, and snippets.

@hlev
Last active December 10, 2018 11:53
Show Gist options
  • Save hlev/4dc7dd83dc3c104769f999063b3bbe6b to your computer and use it in GitHub Desktop.
Save hlev/4dc7dd83dc3c104769f999063b3bbe6b to your computer and use it in GitHub Desktop.
i3 config snippets
# Custom app launcher
set $ides "IDEs [p]hpstorm [c]lion [i]ntellij"
bindsym $mod+i mode $ides
mode $ides {
bindsym p exec --no-startup-id "i3-msg 'workspace 2; exec /opt/jetbrains/phpstorm_latest/bin/phpstorm.sh; mode \\"default\\"'"
bindsym c exec --no-startup-id "i3-msg 'workspace 2; exec /opt/jetbrains/clion_latest/bin/clion.sh; mode \\"default\\"'"
bindsym i exec --no-startup-id "i3-msg 'workspace 2; exec /opt/jetbrains/intellij_latest/bin/idea.sh; mode \\"default\\"'"
bindsym Return mode "default"
bindsym Escape mode "default"
}
# Thinkpad mute/vol+-/micmute keys
#bindcode 198 exec --no-startup-id "pactl set-source-mute 1 toggle"
#bindcode 121 exec "pactl set-sink-mute 0 toggle"
#bindcode 122 exec "pactl set-sink-volume 0 -5%"
#bindcode 123 exec "pactl set-sink-volume 0 +5%"
bindsym XF86AudioMicMute exec --no-startup-id "pactl set-source-mute 1 toggle"
bindsym XF86AudioMute exec --no-startup-id "pactl set-sink-mute @DEFAULT_SINK@ toggle"
bindsym XF86AudioLowerVolume exec --no-startup-id "pactl set-sink-volume @DEFAULT_SINK@ -5%"
bindsym XF86AudioRaiseVolume exec --no-startup-id "pactl set-sink-volume @DEFAULT_SINK@ +5%"
# System ops menu
set $mode_system System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown
mode "$mode_system" {
bindsym l exec --no-startup-id i3exit lock, mode "default"
bindsym e exec --no-startup-id i3exit logout, mode "default"
bindsym s exec --no-startup-id i3exit suspend, mode "default"
bindsym h exec --no-startup-id i3exit hibernate, mode "default"
bindsym r exec --no-startup-id i3exit reboot, mode "default"
bindsym Shift+s exec --no-startup-id i3exit shutdown, mode "default"
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+Pause mode "$mode_system"
#!/bin/sh
lock() {
i3lock
}
case "$1" in
lock)
lock
;;
logout)
i3-msg exit
;;
suspend)
lock && systemctl suspend
;;
hibernate)
lock && systemctl hibernate
;;
reboot)
systemctl reboot
;;
shutdown)
systemctl poweroff
;;
*)
echo "Usage: $0 {lock|logout|suspend|hibernate|reboot|shutdown}"
exit 2
esac
exit 0
@hlev
Copy link
Author

hlev commented Oct 18, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment