Skip to content

Commit

Permalink
desktop: add C-g to polybar & Zen
Browse files Browse the repository at this point in the history
  • Loading branch information
SqrtMinusOne committed Oct 20, 2024
1 parent dff499c commit 5aa83ae
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 12 deletions.
19 changes: 18 additions & 1 deletion .config/polybar/config
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ font-4 = JetBrains Mono Nerd Font:monospace:size=17;4
; Global bar config:3 ends here

; [[file:../../Desktop.org::*Global bar config][Global bar config:4]]
modules-left = i3
modules-left = i3 c-g glyph-left-light-background--blue
; modules-center = test
modules-right = ${env:RIGHT_BLOCKS}

Expand Down Expand Up @@ -516,6 +516,23 @@ format-underline = ${colors.light-green}
format-foreground = ${colors.foreground}
; pomm:2 ends here

; [[file:../../Desktop.org::*C-g][C-g:2]]
[module/c-g]
type = custom/text
content = " C-g"
click-left = bash ~/bin/polybar/c-g.sh
content-background = ${colors.blue}
; C-g:2 ends here

; [[file:../../Desktop.org::*C-g][C-g:3]]
[module/glyph-left-light-background--blue]
type = custom/text
content-background = ${colors.backround}
content-foreground = ${colors.blue}
content = ${glyph.gleft}
content-font = 5
; C-g:3 ends here

; [[file:../../Desktop.org::*SEP][SEP:1]]
[module/SEP]
type = custom/text
Expand Down
8 changes: 5 additions & 3 deletions .emacs.d/desktop.el
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ DIR is either 'left or 'right."
:straight (:host github :repo "SqrtMinusOne/password-store-completion")
:after (exwm)
:config
(add-to-list 'savehist-additional-variables 'password-store-completion)
(require 'password-store-embark)
(password-store-embark-mode))

Expand All @@ -352,13 +353,13 @@ DIR is either 'left or 'right."
"
^Apps^
_t_: Terminal (Alacritty)
_b_: Browser (qutebrowser)
_b_: Browser (Zen)
_s_: Rocket.Chat
_e_: Telegram
_d_: Discord
"
("t" (lambda () (interactive) (my/run-in-background "alacritty")))
("b" (lambda () (interactive) (my/run-in-background "qutebrowser")))
("b" (lambda () (interactive) (my/run-in-background "flatpak run io.github.zen_browser.zen")))
("s" (lambda () (interactive) (my/run-in-background "flatpak run chat.rocket.RocketChat")))
("e" (lambda () (interactive) (my/run-in-background "telegram-desktop")))
("d" (lambda () (interactive) (my/run-in-background "flatpak run com.discordapp.Discord"))))
Expand Down Expand Up @@ -616,7 +617,8 @@ _d_: Discord
"<mode-line> s-<mouse-5>" #'perspective-exwm-cycle-all-buffers-forward
"M-x" #'execute-extended-command
"M-SPC" (general-key "SPC"))
(setq exwm-input-simulation-keys `((,(kbd "M-w") . ,(kbd "C-w"))
(setopt exwm-input-simulation-keys `(
;; (,(kbd "M-w") . ,(kbd "C-w"))
(,(kbd "M-c") . ,(kbd "C-c"))))
(setq exwm-input-global-keys
`(
Expand Down
66 changes: 58 additions & 8 deletions Desktop.org
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,9 @@ Setting the default MIME types
#+begin_src conf-unix :tangle ~/.config/mimeapps.list
[Default Applications]
text/html=qutebrowser.desktop
x-scheme-handler/http=qutebrowser.desktop
x-scheme-handler/https=qutebrowser.desktop
x-scheme-handler/about=qutebrowser.desktop
x-scheme-handler/unknown=qutebrowser.desktop
x-scheme-handler/http=io.github.zen_browser.zen.desktop
x-scheme-handler/https=io.github.zen_browser.zen.desktop
x-scheme-handler/about=io.github.zen_browser.zen.desktop
x-scheme-handler/tg=userapp-Telegram Desktop-7PVWF1.desktop
image/png=com.interversehq.qView.desktop
image/jpg=com.interversehq.qView.desktop
Expand Down Expand Up @@ -767,6 +766,7 @@ Also, by default it tries to launch stuff with =gtk-launch=, which is in the =gt
:straight (:host github :repo "SqrtMinusOne/password-store-completion")
:after (exwm)
:config
(add-to-list 'savehist-additional-variables 'password-store-completion)
(require 'password-store-embark)
(password-store-embark-mode))
#+end_src
Expand Down Expand Up @@ -807,7 +807,8 @@ Also other local keybindings, that are also available only in =line-mode=:

Simulation keys.
#+begin_src emacs-lisp :tangle no :noweb-ref exwm-keybindings
(setq exwm-input-simulation-keys `((,(kbd "M-w") . ,(kbd "C-w"))
(setopt exwm-input-simulation-keys `(
;; (,(kbd "M-w") . ,(kbd "C-w"))
(,(kbd "M-c") . ,(kbd "C-c"))))
#+end_src

Expand Down Expand Up @@ -932,13 +933,13 @@ A +transient+ hydra for shortcuts for the most frequent apps.
"
^Apps^
_t_: Terminal (Alacritty)
_b_: Browser (qutebrowser)
_b_: Browser (Zen)
_s_: Rocket.Chat
_e_: Telegram
_d_: Discord
"
("t" (lambda () (interactive) (my/run-in-background "alacritty")))
("b" (lambda () (interactive) (my/run-in-background "qutebrowser")))
("b" (lambda () (interactive) (my/run-in-background "flatpak run io.github.zen_browser.zen")))
("s" (lambda () (interactive) (my/run-in-background "flatpak run chat.rocket.RocketChat")))
("e" (lambda () (interactive) (my/run-in-background "telegram-desktop")))
("d" (lambda () (interactive) (my/run-in-background "flatpak run com.discordapp.Discord"))))
Expand Down Expand Up @@ -2150,7 +2151,7 @@ font-4 = JetBrains Mono Nerd Font:monospace:size=17;4

Modules. Because I sometimes set up different blocks on different monitors, they are set via environment variables.
#+begin_src conf-windows
modules-left = i3
modules-left = i3 c-g glyph-left-light-background--blue
; modules-center = test
modules-right = ${env:RIGHT_BLOCKS}

Expand Down Expand Up @@ -2831,6 +2832,55 @@ interval = 1
format-underline = ${colors.light-green}
format-foreground = ${colors.foreground}
#+end_src
*** C-g
#+begin_src bash :tangle ./bin/polybar/c-g.sh
EMACS_FLAG="-l /home/pavel/.emacs.d/desktop.el"
EXCLUDE_PATTERN="dbus-launch --exit-with-session emacs"
EMACS_PIDS=$(pgrep -f "emacs.*${EMACS_FLAG}")
SIGNAL_SENT=false

for PID in $EMACS_PIDS; d o
CMDLINE=$(ps -p "$PID" -o args=)

if [[ "$CMDLINE" == *"$EXCLUDE_PATTERN"* ]]; then
continue
fi

kill -SIGUSR2 "$PID" 2>/dev/null

if [ $? -eq 0 ]; then
echo "Sent SIGUSR2 to Emacs (PID: $PID)"
SIGNAL_SENT=true
else
echo "Failed to send SIGUSR2 to Emacs (PID: $PID)"
fi
done

if [ "$SIGNAL_SENT" = false ]; then
echo "Emacs process not found or already handled."
exit 1
fi

exit 0
#+end_src

#+begin_src conf-windows
[module/c-g]
type = custom/text
content = " C-g"
click-left = bash ~/bin/polybar/c-g.sh
content-background = ${colors.blue}
#+end_src

#+begin_src conf-windows
[module/glyph-left-light-background--blue]
type = custom/text
content-background = ${colors.backround}
content-foreground = ${colors.blue}
content = ${glyph.gleft}
content-font = 5
#+end_src

*** SEP
A simple separator
#+begin_src conf-windows
Expand Down

0 comments on commit 5aa83ae

Please sign in to comment.