Util : Add _twice.
This commit is contained in:
parent
091c9e7276
commit
081a2e517a
|
@ -132,7 +132,22 @@ function _bell() {
|
||||||
echo -e '\a'
|
echo -e '\a'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Get users.
|
||||||
function _get_users() {
|
function _get_users() {
|
||||||
local users=("voronind" "dasha")
|
local users=("voronind" "dasha")
|
||||||
echo ${users[@]}
|
echo ${users[@]}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Force the command to be called twice within the specified period in seconds. Used primarily in important keyboard shortcuts like poweroff.
|
||||||
|
# Usage: _twice <PERIOD> <COMMAND>
|
||||||
|
function _twice() {
|
||||||
|
local IFS=$'\n'
|
||||||
|
local file="/tmp/.twice"
|
||||||
|
local period=${1}
|
||||||
|
local command="${@:2}"
|
||||||
|
|
||||||
|
[[ "$(cat ${file} 2> /dev/null)" = "${command}" ]] && ${command}
|
||||||
|
echo "${command}" > "${file}"
|
||||||
|
sleep ${period}
|
||||||
|
rm "${file}" 2> /dev/null
|
||||||
|
}
|
||||||
|
|
|
@ -18,8 +18,8 @@ floating_modifier $mod normal
|
||||||
bindsym $mod+Shift+c reload
|
bindsym $mod+Shift+c reload
|
||||||
|
|
||||||
# Exit sway (logs you out of your Wayland session).
|
# Exit sway (logs you out of your Wayland session).
|
||||||
bindsym $mod+z exec 'swaylock -F -c 000000 -k --font "SF Pro Display Medium" --font-size 14'
|
bindsym $mod+z exec '_twice 1 swaylock -F -c 000000 -k --font "SF Pro Display Medium" --font-size 14'
|
||||||
bindsym $mod+Shift+z exec 'swaymsg exit'
|
bindsym $mod+Shift+z exec '_twice 1 swaymsg exit'
|
||||||
|
|
||||||
# Show last notification.
|
# Show last notification.
|
||||||
bindsym $mod+n exec makoctl restore
|
bindsym $mod+n exec makoctl restore
|
||||||
|
@ -33,6 +33,3 @@ bindsym XF86MonBrightnessUp exec light -A 10
|
||||||
bindsym XF86AudioRaiseVolume exec 'pactl set-sink-volume @DEFAULT_SINK@ +1%'
|
bindsym XF86AudioRaiseVolume exec 'pactl set-sink-volume @DEFAULT_SINK@ +1%'
|
||||||
bindsym XF86AudioLowerVolume exec 'pactl set-sink-volume @DEFAULT_SINK@ -1%'
|
bindsym XF86AudioLowerVolume exec 'pactl set-sink-volume @DEFAULT_SINK@ -1%'
|
||||||
bindsym XF86AudioMute exec 'pactl set-sink-mute @DEFAULT_SINK@ toggle'
|
bindsym XF86AudioMute exec 'pactl set-sink-mute @DEFAULT_SINK@ toggle'
|
||||||
|
|
||||||
# Lock screen
|
|
||||||
bindsym $mod+z exec 'swaylock -k -c 000000'
|
|
||||||
|
|
Loading…
Reference in a new issue