summaryrefslogtreecommitdiffhomepage
path: root/init.org
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-02-09 05:34:46 +0000
committerjao <jao@gnu.org>2022-02-09 05:34:46 +0000
commit2ff0b1593ae8d372b696ecb3640b0627b863a20f (patch)
tree20b80ec79d81f2d0297d542c77eb59e7b47d56b9 /init.org
parente5b6526056de4db90d4b6a7a682a4260c13021ac (diff)
downloadelibs-2ff0b1593ae8d372b696ecb3640b0627b863a20f.tar.gz
elibs-2ff0b1593ae8d372b696ecb3640b0627b863a20f.tar.bz2
sway bits
Diffstat (limited to 'init.org')
-rw-r--r--init.org25
1 files changed, 20 insertions, 5 deletions
diff --git a/init.org b/init.org
index 9333074..601942f 100644
--- a/init.org
+++ b/init.org
@@ -153,6 +153,10 @@
,(car args)
"* jao-exec - console *"
(string-join (append (list ,@args) other-args) " "))))
+
+ (defun jao-exec-running-p (pr)
+ (not (string-blank-p (shell-command-to-string (concat "pidof " pr)))))
+
#+end_src
*** App launcher
#+begin_src emacs-lisp
@@ -162,9 +166,6 @@
#+end_src
*** Brightness control
#+begin_src emacs-lisp
- (when (eq 'pgtk window-system)
- (defalias 'x-change-window-property #'ignore))
-
(jao-def-exec jao-bright-set-up "brightnessctl" "-q" "s" "5%+")
(jao-def-exec jao-bright-set-down "brightnessctl" "-q" "s" "5%-")
@@ -523,11 +524,22 @@
(make-symbolic-link f "~/.wallpaper.sway" t))
(defun jao-sway-run-or-focus (cmd &optional ws)
- (if (not (string-blank-p (shell-command-to-string (format "pidof %s" cmd))))
+ (if (jao-exec-running-p "firefox")
(jao-swaymsg (format "[app_id=%s] focus" cmd))
(jao-swaymsg (format "workspace %s" (or ws 2)))
(start-process-shell-command cmd nil cmd)))
+ (defun jao-sway-run-or-focus-deezer ()
+ (interactive)
+ (if (jao-exec-running-p "deezer-desktop")
+ (jao-swaymsg "[app_id=Deezer] scratchpad show")
+ (start-process-shell-command "deezer" nil "deezer &")
+ (jao-sway-run-or-focus-deezer)))
+
+ (defun jao-sway-run-or-focus-firefox ()
+ (interactive)
+ (jao-sway-run-or-focus "firefox"))
+
(defun jao-sway-enable ()
(setq jao-browse-doc-use-emacs-p t)
(setq jao-minibuffer-right-margin "")
@@ -536,9 +548,12 @@
(jao-set-transparency 85)
(jao-themes-setup)
(display-time-mode 1)
+ (global-set-key (kbd "s-f") #'jao-sway-run-or-focus-firefox)
(message "Welcome to sway"))
- (when jao-sway-enabled (add-hook 'after-init-hook #'jao-sway-enable))
+ (when jao-sway-enabled
+ (defalias 'x-change-window-property #'ignore)
+ (add-hook 'after-init-hook #'jao-sway-enable))
#+end_src
*** wallpaper