From 938d888adede09af70929a34a6242309622e8cdd Mon Sep 17 00:00:00 2001 From: Trumeet Date: Fri, 18 Feb 2022 17:57:51 -0800 Subject: Use xbindkeys to handle shortcuts --- SystemdGraphicalSession/i3-session.target | 1 + SystemdGraphicalSession/i3config | 72 +++++++++++++++++++++++++++++ SystemdGraphicalSession/xbindkeys.service | 11 +++++ SystemdGraphicalSession/xbindkeysrc | 75 +++++++++++++++++++++++++++++++ 4 files changed, 159 insertions(+) create mode 100644 SystemdGraphicalSession/i3config create mode 100644 SystemdGraphicalSession/xbindkeys.service create mode 100644 SystemdGraphicalSession/xbindkeysrc diff --git a/SystemdGraphicalSession/i3-session.target b/SystemdGraphicalSession/i3-session.target index 1731056..5de5136 100644 --- a/SystemdGraphicalSession/i3-session.target +++ b/SystemdGraphicalSession/i3-session.target @@ -6,3 +6,4 @@ Wants=xdg-desktop-autostart.target Wants=xrdb.service Wants=deadd-notification-center.service Wants=xcompmgr.service +Wants=xbindkeys.service diff --git a/SystemdGraphicalSession/i3config b/SystemdGraphicalSession/i3config new file mode 100644 index 0000000..447f9a5 --- /dev/null +++ b/SystemdGraphicalSession/i3config @@ -0,0 +1,72 @@ +set $mod Mod4 +font pango:monospace 18 +hide_edge_borders smart +floating_modifier $mod +bindsym $mod+Shift+q kill +bindsym $mod+h focus left +bindsym $mod+j focus down +bindsym $mod+k focus up +bindsym $mod+l focus right +bindsym $mod+Shift+h move left +bindsym $mod+Shift+j move down +bindsym $mod+Shift+k move up +bindsym $mod+Shift+l move right +bindsym $mod+Shift+f fullscreen toggle +bindsym $mod+s layout stacking +bindsym $mod+w layout tabbed +bindsym $mod+e layout toggle split +bindsym $mod+Shift+c reload +bindsym $mod+Shift+r restart +bindsym $mod+Shift+space floating toggle +set $refresh_i3status killall -SIGUSR1 i3status +set $ws1 "1" +set $ws2 "2" +set $ws3 "3" +set $ws4 "4" +set $ws5 "5" +set $ws6 "6" +set $ws7 "7" +set $ws8 "8" +set $ws9 "9" +set $ws10 "10" +bindsym $mod+1 workspace number $ws1 +bindsym $mod+2 workspace number $ws2 +bindsym $mod+3 workspace number $ws3 +bindsym $mod+4 workspace number $ws4 +bindsym $mod+5 workspace number $ws5 +bindsym $mod+6 workspace number $ws6 +bindsym $mod+7 workspace number $ws7 +bindsym $mod+8 workspace number $ws8 +bindsym $mod+9 workspace number $ws9 +bindsym $mod+0 workspace number $ws10 +bindsym $mod+Shift+1 move container to workspace number $ws1 +bindsym $mod+Shift+2 move container to workspace number $ws2 +bindsym $mod+Shift+3 move container to workspace number $ws3 +bindsym $mod+Shift+4 move container to workspace number $ws4 +bindsym $mod+Shift+5 move container to workspace number $ws5 +bindsym $mod+Shift+6 move container to workspace number $ws6 +bindsym $mod+Shift+7 move container to workspace number $ws7 +bindsym $mod+Shift+8 move container to workspace number $ws8 +bindsym $mod+Shift+9 move container to workspace number $ws9 +bindsym $mod+Shift+0 move container to workspace number $ws10 +bar { + status_command i3status + font pango:Icons 10 +} +bindsym $mod+x [urgent=latest] focus +set $Locker systemctl --user start i3lock +set $mode_system System (l) lock, (Shift+e) logout, (Shift+s) suspend, (Shift+h) hibernate, (Ctrl+Shift+r) reboot, (Ctrl+Shift+s) shutdown +mode "$mode_system" { + bindsym l exec --no-startup-id $Locker, mode "default" + bindsym Shift+e exec --no-startup-id systemctl --user stop graphical-session.target + bindsym Shift+s exec --no-startup-id $Locker && systemctl suspend, mode "default" + bindsym Shift+h exec --no-startup-id $Locker && systemctl hibernate, mode "default" + bindsym Control+Shift+r exec --no-startup-id systemctl reboot, mode "default" + bindsym Control+Shift+s exec --no-startup-id systemctl poweroff -i, mode "default" + + # back to normal: Enter or Escape + bindsym Return mode "default" + bindsym Escape mode "default" +} + +bindsym Control+Mod1+Delete mode "$mode_system" diff --git a/SystemdGraphicalSession/xbindkeys.service b/SystemdGraphicalSession/xbindkeys.service new file mode 100644 index 0000000..05c9dff --- /dev/null +++ b/SystemdGraphicalSession/xbindkeys.service @@ -0,0 +1,11 @@ +[Unit] +Description=Xorg Key Binding +After=graphical-session-pre.target +PartOf=graphical-session.target +Documentation=man:xbindkeys(1) + +[Service] +Slice=session.slice +Type=simple +ExecStart=sh -c 'exec /usr/bin/xbindkeys -n -f $XDG_CONFIG_HOME/xbindkeys/xbindkeysrc' +ExecReload=kill -HUP $MAINPID diff --git a/SystemdGraphicalSession/xbindkeysrc b/SystemdGraphicalSession/xbindkeysrc new file mode 100644 index 0000000..e6d6c39 --- /dev/null +++ b/SystemdGraphicalSession/xbindkeysrc @@ -0,0 +1,75 @@ +########################### +# xbindkeys configuration # +########################### +# +# Version: 0.1.3 +# +# If you edit this, do not forget to uncomment any lines that you change. +# The pound(#) symbol may be used anywhere for comments. +# +# A list of keys is in /usr/include/X11/keysym.h and in +# /usr/include/X11/keysymdef.h +# The XK_ is not needed. +# +# List of modifier (on my keyboard): +# Control, Shift, Mod1 (Alt), Mod2 (NumLock), +# Mod3 (CapsLock), Mod4, Mod5 (Scroll). +# +# Another way to specifie a key is to use 'xev' and set the +# keycode with c:nnn or the modifier with m:nnn where nnn is +# the keycode or the state returned by xev +# +# This file is created by xbindkey_config +# The structure is : +# # Remark +# "command" +# m:xxx + c:xxx +# Shift+... + + + + +#keystate_numlock = enable +#keystate_scrolllock = enable +#keystate_capslock = enable + + + +#Application Launcher +"systemd-run -q --user --scope --no-block rofi -show combi -combi-modi 'run,drun,window' -modi combi" + Mod4 + r + +#XTerm +"systemd-run -q --user --scope --no-block xterm" + Mod4 + Return + +# Increase volume +"pactl set-sink-volume @DEFAULT_SINK@ +2% && killall -SIGUSR1 i3status" + XF86AudioRaiseVolume + +# Decrease volume +"pactl set-sink-volume @DEFAULT_SINK@ -2% && killall -SIGUSR1 i3status" + XF86AudioLowerVolume + +# Mute volume +"pactl set-sink-mute @DEFAULT_SINK@ toggle && killall -SIGUSR1 i3status" + XF86AudioMute + +# Mute microphone +"pactl set-source-mute @DEFAULT_SOURCE@ toggle" + Shift + XF86AudioMicMute + +# Display Settings +"lxrandr" + Mod4 + p + +# Volume Settings +"pavucontrol" + Mod4 + v + +# Flameshot +"flameshot gui" + Print + +# +# End of xbindkeys configuration -- cgit v1.2.3