Add scripts to toggle automatic lockscreen

This commit is contained in:
Thomas Dehaeze 2019-12-16 08:53:47 +01:00
parent 250be01ab3
commit df05138340
2 changed files with 47 additions and 2 deletions

View File

@ -83,7 +83,7 @@
modules-left = i3 xwindow modules-left = i3 xwindow
modules-center = modules-center =
modules-right = pulseaudio wired-network wireless-network xbacklight nordvpn dunst unread_mail cpu battery temperature date modules-right = pulseaudio wireless-network xbacklight nordvpn lockscreen dunst unread_mail cpu battery temperature date
tray-position = right tray-position = right
tray-padding = 0 tray-padding = 0
@ -312,7 +312,7 @@
thermal-zone = 0 thermal-zone = 0
warn-temperature = 70 warn-temperature = 70
;; Temperature off one cpu core ;; Temperature off one cpu core
hwmon-path = /sys/devices/platform/coretemp.0/hwmon/hwmon2/temp1_input hwmon-path = /sys/devices/platform/coretemp.0/hwmon/hwmon1/temp1_input
format = %{A1:termite -e "watch sensors" &:}<ramp> <label>%{A} format = %{A1:termite -e "watch sensors" &:}<ramp> <label>%{A}
format-underline = ${colors.background} format-underline = ${colors.background}
@ -471,6 +471,34 @@
fi fi
#+END_SRC #+END_SRC
* Dunst
#+BEGIN_SRC conf
[module/lockscreen]
type = custom/script
format-underline = ${colors.background}
click-left = ~/scripts/lockscreen-toggle.sh
format = <label>
exec = ~/.config/polybar/scripts/lockscreen.sh
interval = 2
#+END_SRC
** Lock screen Status script
:PROPERTIES:
:header-args: :tangle ~/.config/polybar/scripts/lockscreen.sh
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
#+BEGIN_SRC bash
if pgrep -x "xautolock" >/dev/null
then
echo "";
else
echo "%{F#FB4934}%{F-}";
fi
#+END_SRC
* Weather * Weather
https://github.com/x70b1/polybar-scripts/tree/master/polybar-scripts/openweathermap-fullfeatured https://github.com/x70b1/polybar-scripts/tree/master/polybar-scripts/openweathermap-fullfeatured

View File

@ -83,6 +83,23 @@ Finally, lock the screen using =i3lock=.
revert revert
#+end_src #+end_src
* Toggle Automatic Lock Screen
:PROPERTIES:
:header-args: :tangle ~/scripts/lockscreen-toggle.sh
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
#+begin_src bash
if pgrep -x "xautolock" >/dev/null
then
pkill xautolock;
notify-send "Lock Screen Desactivated"
else
xautolock -locker "~/scripts/lockscreen.sh" -detectsleep -time 30 -notify 60 -notifier "dunstify --replace=31846 -u critical -t 10000 -- 'Locking Screen' '60 seconds'" &
notify-send "Lock Screen Activated"
fi
#+end_src
* Delete first page of PDF * Delete first page of PDF
:PROPERTIES: :PROPERTIES:
:header-args: :tangle ~/scripts/pdf-delete-first-page.sh :header-args: :tangle ~/scripts/pdf-delete-first-page.sh