mirror of
https://github.com/ebeem/guile-swayer.git
synced 2024-12-26 21:59:03 +01:00
Merge pull request #2 from wrest64/master
move socket connects into functions
This commit is contained in:
commit
8133372fba
2 changed files with 11 additions and 7 deletions
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/guile
|
#!/usr/bin/env guile
|
||||||
!#
|
!#
|
||||||
|
|
||||||
;; assuming your are running from a path relative to swaypic & modules
|
;; assuming your are running from a path relative to swaypic & modules
|
||||||
|
@ -25,6 +25,7 @@
|
||||||
(ice-9 pretty-print)
|
(ice-9 pretty-print)
|
||||||
(swayipc))
|
(swayipc))
|
||||||
|
|
||||||
|
(SWAY-CONNECT-SOCKTES!)
|
||||||
|
|
||||||
;; get focused workspace from a list of workspaces
|
;; get focused workspace from a list of workspaces
|
||||||
(define (focused-workspace-name workspaces)
|
(define (focused-workspace-name workspaces)
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
|
|
||||||
SWAY-SOCKET-PATH
|
SWAY-SOCKET-PATH
|
||||||
SWAY-COMMAND-SOCKET
|
SWAY-COMMAND-SOCKET
|
||||||
|
SWAY-CONNECT-SOCKETS!
|
||||||
SWAY-LISTENER-SOCKET
|
SWAY-LISTENER-SOCKET
|
||||||
SWAY-LISTENER-THREAD
|
SWAY-LISTENER-THREAD
|
||||||
SWAY-MSG-MAGIC
|
SWAY-MSG-MAGIC
|
||||||
|
@ -96,12 +97,14 @@
|
||||||
;; sway listen socket, this is used to listen to subscribed events
|
;; sway listen socket, this is used to listen to subscribed events
|
||||||
;; from sway via IPC.
|
;; from sway via IPC.
|
||||||
(define SWAY-LISTENER-SOCKET (socket AF_UNIX SOCK_STREAM 0))
|
(define SWAY-LISTENER-SOCKET (socket AF_UNIX SOCK_STREAM 0))
|
||||||
(connect SWAY-LISTENER-SOCKET (make-socket-address AF_UNIX SWAY-SOCKET-PATH))
|
|
||||||
|
|
||||||
;; sway command socket, this is used to send commands and queries
|
;; sway command socket, this is used to send commands and queries
|
||||||
;; to sway via IPC.
|
;; to sway via IPC.
|
||||||
(define SWAY-COMMAND-SOCKET (socket AF_UNIX SOCK_STREAM 0))
|
(define SWAY-COMMAND-SOCKET (socket AF_UNIX SOCK_STREAM 0))
|
||||||
(connect SWAY-COMMAND-SOCKET (make-socket-address AF_UNIX SWAY-SOCKET-PATH))
|
|
||||||
|
(define (SWAY-CONNECT-SOCKETS!)
|
||||||
|
(connect SWAY-LISTENER-SOCKET (make-socket-address AF_UNIX SWAY-SOCKET-PATH))
|
||||||
|
(connect SWAY-COMMAND-SOCKET (make-socket-address AF_UNIX SWAY-SOCKET-PATH)))
|
||||||
|
|
||||||
;; Hashtable of mutexes for synchronization, keeps each socket separate.
|
;; Hashtable of mutexes for synchronization, keeps each socket separate.
|
||||||
;; This is important to lock sockets while reading/writing.
|
;; This is important to lock sockets while reading/writing.
|
||||||
|
|
Loading…
Reference in a new issue