Add flock wrapper for running only one process
This commit is contained in:
parent
c7969c5a1d
commit
f53f4013ea
3 changed files with 13 additions and 4 deletions
|
@ -145,7 +145,7 @@
|
||||||
"warning": 70,
|
"warning": 70,
|
||||||
"critical": 90
|
"critical": 90
|
||||||
},
|
},
|
||||||
"on-click": "swaymsg exec \\$term_float btop"
|
"on-click": "swaymsg exec \\$flock \\$term_float btop"
|
||||||
},
|
},
|
||||||
|
|
||||||
"memory": {
|
"memory": {
|
||||||
|
@ -155,7 +155,7 @@
|
||||||
"warning": 70,
|
"warning": 70,
|
||||||
"critical": 90
|
"critical": 90
|
||||||
},
|
},
|
||||||
"on-click": "swaymsg exec \\$term_float btop"
|
"on-click": "swaymsg exec \\$flock \\$term_float btop"
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -174,7 +174,7 @@
|
||||||
"tooltip-format-wifi": "{icon} {ifname} ({essid}): {ipaddr}",
|
"tooltip-format-wifi": "{icon} {ifname} ({essid}): {ipaddr}",
|
||||||
"tooltip-format-disconnected": "{icon} disconnected",
|
"tooltip-format-disconnected": "{icon} disconnected",
|
||||||
"tooltip-format-disabled": "{icon} disabled",
|
"tooltip-format-disabled": "{icon} disabled",
|
||||||
"on-click": "swaymsg exec \\$term_float nmtui connect"
|
"on-click": "swaymsg exec \\$flock \\$term_float nmtui connect"
|
||||||
},
|
},
|
||||||
|
|
||||||
"bluetooth": {
|
"bluetooth": {
|
||||||
|
|
|
@ -9,6 +9,9 @@ set $down j
|
||||||
set $up k
|
set $up k
|
||||||
set $right l
|
set $right l
|
||||||
|
|
||||||
|
# flock wrapper for running only one process
|
||||||
|
set $flock /usr/share/sway/scripts/flock.sh
|
||||||
|
|
||||||
# Your preferred terminal emulator
|
# Your preferred terminal emulator
|
||||||
set $term alacritty
|
set $term alacritty
|
||||||
set $term_cwd $term --working-directory "$(/usr/share/sway/scripts/swaycwd.sh 2>/dev/null || echo $HOME)"
|
set $term_cwd $term --working-directory "$(/usr/share/sway/scripts/swaycwd.sh 2>/dev/null || echo $HOME)"
|
||||||
|
@ -24,7 +27,7 @@ set $menu rofi -show combi -combi-modi "drun,run" -terminal $term -ssh-command "
|
||||||
set $bindsym bindsym --to-code
|
set $bindsym bindsym --to-code
|
||||||
|
|
||||||
# Bluetooth menu
|
# Bluetooth menu
|
||||||
set $bluetooth $term_float bluetuith
|
set $bluetooth $flock $term_float bluetuith
|
||||||
|
|
||||||
# Volume notification
|
# Volume notification
|
||||||
set $volume_bar /usr/share/sway/scripts/volume-notify.sh
|
set $volume_bar /usr/share/sway/scripts/volume-notify.sh
|
||||||
|
|
6
usr/share/sway/scripts/flock.sh
Executable file
6
usr/share/sway/scripts/flock.sh
Executable file
|
@ -0,0 +1,6 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
HASH="$(echo "$@" | shasum | cut -f1 -d" " | cut -c1-7)"
|
||||||
|
|
||||||
|
mkdir -p "$HOME/.local/state"
|
||||||
|
|
||||||
|
flock --verbose -n "$HOME/.local/state/${HASH}.lock" "$@"
|
Loading…
Add table
Reference in a new issue