xmonad NamedScratchpad not working as expected - xmonad

I added NamedScratchpad configs but calling the scratchpad with key bindings is not displaying workspace and the syslog shows
Aug 28 20:20:52 username /usr/libexec/gdm-x-session[2206]: Prelude.head: empty list
my xmonad configs are:
myScratchPads :: [NamedScratchpad]
myScratchPads = [ NS "terminal" spawnTerm findTerm manageTerm
, NS "mocp" spawnMocp findMocp manageMocp
, NS "qalculate-qt" spawnCalc findCalc manageCalc
]
where
spawnTerm = myTerminal ++ " -n scratchpad"
findTerm = resource =? "scratchpad"
manageTerm = customFloating $ W.RationalRect l t w h
where
h = 0.9
w = 0.9
t = 0.95 -h
l = 0.95 -w
spawnMocp = myTerminal ++ " -n mocp 'mocp'"
findMocp = resource =? "mocp"
manageMocp = customFloating $ W.RationalRect l t w h
where
h = 0.9
w = 0.9
t = 0.95 -h
l = 0.95 -w
-- spawnCalc = "qalculate-gtk"
spawnCalc = "qalculate-qt"
-- findCalc = className =? "Qalculate-gtk"
findCalc = className =? "qalculate-qt"
manageCalc = customFloating $ W.RationalRect l t w h
where
h = 0.5
w = 0.4
t = 0.75 -h
l = 0.70 -w
myManageHook :: XMonad.Query (Data.Monoid.Endo WindowSet)
myManageHook =
def
<+> manageSmart
<+> manageDialog
<+> manageScratchPad
<+> manageWindows
where
manageSmart = placeHook simpleSmart
manageDialog = composeOne [ isDialog -?> doCenterFloat ]
manageScratchPad = namedScratchpadManageHook myScratchPads
manageWindows = composeAll
[ className =? "Google-chrome" --> doShift ( myWorkspaces !! 1 )
, className =? "Cypress" --> doShift ( myWorkspaces !! 1)
, className =? "Gimp" --> doShift ( myWorkspaces !! 8 )
, className =? "Gimp" --> doFloat
, title =? "Oracle VM VirtualBox Manager" --> doFloat
, className =? "VirtualBox Manager" --> doShift ( myWorkspaces !! 4 )
]
.....
--- shortcut keys
, ("M-t t", namedScratchpadAction myScratchPads "terminal")
, ("M-t m", namedScratchpadAction myScratchPads "mocp")
, ("M-t c", namedScratchpadAction myScratchPads "qalculate-qt")
I am using Debian 11 OS and everything else in xmonad configs is working fine.

Related

Move and resize XMonad window - RationalRect call compiler error

to send the focused window to the center of the screen I have the following configuration
main = do
xmonad $ docks def
{ manageHook = myManageHook <+> manageHook def
, layoutHook = avoidStruts $ layoutHook def
, logHook = dynamicLogWithPP xmobarPP
, terminal = myTerminal
} `additionalKeys`
[ ((myModkey , xK_space), spawn myTerminal )
, ((myModkey , xK_0), withFocused (keysMoveWindowTo (512,384) (0, 0)))
]
I would remove the call to keysMoveWindowTo because it does not allow to set the window size (...) but only specify dx and dy; than I would like to use:
((myModkey , xK_0), withFocused (doRectFloat (RationalRect (1 % 4) (1 % 4) (1 % 2) (1 % 2))))
but the compiler says:
xmonad.hs:87:58: error:
Data constructor not in scope:
RationalRect
:: Ratio a0
87 |, ((myModkey , xK_0), withFocused (doRectFloat (RationalRect (1 % 4) (1 % 4) (1 % 2) (1 % 2))))
What is the correct way to bind keys with doRectFloat function?
Thanks
Nello
doRectFloat does not provide an X operation needed by withFocused.
Enhancing your previous solution, you could add keysResizeWindow to do the resizing, e.g.
, ((myModkey , xK_0), withFocused (
keysMoveWindowTo (512,384) (1%2, 1%2) >> keysResizeWindow (512, 384) (1%2, 1%2)
))

Clickable workspaces

I'm using XMonad in combination with two xmobar instances, and I'm using IndependentScreens because I have a dual monitor setup. I'm having an issue with clickable workspaces ever since I introduced the second monitor. The thing is, IndependentScreens labels workspaces as 0_1, 1_1, 0_2, 1_2, ..., and the code I had worked only based on WorkspaceId, not ScreenId. I've compiled xmonad and xmonad-contrib from source so that I can use XMonad.Util.ClickableWorkspaces, however, the documentation is obscure and I couldn't find an example of proper usage anywhere. I've tried various things not worth mentioning, IMO.
This is my config:
import System.IO
import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.ServerMode
import XMonad.Hooks.SetWMName
import XMonad.Layout.IndependentScreens
import XMonad.Layout.Gaps
import XMonad.Layout.Spacing
import XMonad.Util.EZConfig (additionalKeysP)
import XMonad.Util.Run (spawnPipe)
import Data.Ord
import qualified XMonad.StackSet as W
import qualified Data.Map as M
import XMonad.Util.WorkspaceCompare
import XMonad.Util.ClickableWorkspaces
myLayout = gaps [(U, 10), (R, 10), (L, 10), (D, 10)] $ spacingRaw True (Border 0 10 10 10) True (Border 10 10 10 10) True $
layoutHook def
myWorkspaces =
[ (xK_1, "1")
, (xK_2, "2")
, (xK_3, "3")
, (xK_4, "4")
, (xK_5, "5")
, (xK_6, "6")
, (xK_7, "7")
, (xK_8, "8")
, (xK_9, "9")
, (xK_0, "10")
, (xK_minus, "11")
, (xK_equal, "12")
]
myKeys conf#(XConfig {XMonad.modMask = modMask}) = M.fromList $
[ ((modMask, key), windows $ onCurrentScreen W.greedyView ws)
| (key, ws) <- myWorkspaces
]
++
[ ((modMask .|. shiftMask, key), windows $ onCurrentScreen W.shift ws)
| (key, ws) <- myWorkspaces
]
++
[
-- Spawn the terminal
((modMask .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf)
-- Spawn dmenu
, ((modMask, xK_p), spawn "dmenu_run")
-- Close focused window
, ((modMask .|. shiftMask, xK_c), kill)
-- Rotate through the available layout algorithms
, ((modMask, xK_space ), sendMessage NextLayout)
-- Reset the layouts on the current workspace to default
, ((modMask .|. shiftMask, xK_space), setLayout $ XMonad.layoutHook conf)
-- Resize viewed windows to the correct size
, ((modMask, xK_n), refresh)
-- Move focus to the next window
, ((modMask, xK_Tab), windows W.focusDown)
-- Move focus to the next window
, ((modMask, xK_j), windows W.focusDown)
-- Move focus to the previous window
, ((modMask, xK_k), windows W.focusUp)
-- Move focus to the master window
, ((modMask, xK_m), windows W.focusMaster)
-- Swap the focused window and the master window
, ((modMask, xK_Return), windows W.swapMaster)
-- Swap the focused window with the next window
, ((modMask .|. shiftMask, xK_j), windows W.swapDown)
-- Swap the focused window with the previous window
, ((modMask .|. shiftMask, xK_k), windows W.swapUp)
-- Shrink the master area
, ((modMask, xK_h), sendMessage Shrink)
-- Expand the master area
, ((modMask, xK_l), sendMessage Expand)
-- Push window back into tiling
, ((modMask, xK_t), withFocused $ windows . W.sink)
-- Increment the number of windows in the master area
, ((modMask, xK_comma), sendMessage (IncMasterN 1))
-- Deincrement the number of windows in the master area
, ((modMask, xK_period), sendMessage (IncMasterN (-1)))
-- toggle the status bar gap
, ((modMask, xK_b), sendMessage ToggleStruts)
-- Restart xmonad
, ((modMask, xK_q), broadcastMessage ReleaseResources >> restart "xmonad" True)
]
myAdditionalKeysP =
[
("M-<F2>", spawn "thunar")
, ("M-<F3>", spawn "firefox")
, ("M-<F4>", spawn "code")
, ("M-<F5>", spawn "thunderbird")
, ("M-<Escape>", spawn "xfce4-appfinder")
, ("M4-<Print>", spawn "xfce4-screenshooter")
, ("M4-<KP_Add>", spawn "amixer -D pulse sset Master 5%+")
, ("M4-<KP_Subtract>", spawn "amixer -D pulse sset Master 5%-")
, ("M-C-p", spawn "passmenu")
, ("M-C-c", spawn "clipmenu")
, ("M-C-m", spawn "mailwatch_restart")
, ("M-C-x", spawn "xfce4-panel -r")
, ("M-C-<Left>", spawn "playerctl previous")
, ("M-C-<Right>", spawn "playerctl next")
, ("M-C-<Space>", spawn "playerctl play-pause")
]
clickable' :: WorkspaceId -> String
clickable' w = xmobarAction ("xmonadctl view\\\"" ++ w ++ "\\\"") "1" w
compareNumbers = comparing (read :: String -> Int)
pp h s = marshallPP s def
{ ppOutput = hPutStrLn h
, ppCurrent = xmobarColor "blue" "" . wrap "[" "]"
, ppHiddenNoWindows = xmobarColor "grey" "" . clickable'
, ppVisible = wrap "(" ")"
, ppUrgent = xmobarColor "red" "yellow"
, ppOrder = \(ws:_:_:_) -> [pad ws]
, ppHidden = clickable'
, ppSort = mkWsSort $ return compareNumbers
}
main = do
xmprocs <- mapM (\i -> spawnPipe $ "xmobar ~/.config/xmobar/xmobarrc-" ++ show i ++ " -x" ++ show i) [0..1]
xmonad $ docks def
{
workspaces = withScreens 2 (map show [1..12])
, keys = myKeys
, borderWidth = 2
, focusedBorderColor = "#226fa5"
, normalBorderColor = "#191919"
, handleEventHook = serverModeEventHookCmd
<+> serverModeEventHook
<+> serverModeEventHookF "XMONAD_PRINT" (io . putStrLn)
, layoutHook = avoidStruts myLayout
, logHook = mapM_ dynamicLogWithPP $ zipWith pp xmprocs [0..1]
, startupHook = setWMName "LG3D"
, manageHook = manageDocks
} `additionalKeysP` myAdditionalKeysP
How can I properly use clickablePP with my setup, or whatever is needed to make the workspaces clickable?
This guy has this in his xmonad.hs
myClickableWorkspaces :: [String]
myClickableWorkspaces = clickable . (map xmobarEscape)
-- $ [" 1 ", " 2 ", " 3 ", " 4 ", " 5 ", " 6 ", " 7 ", " 8 ", " 9 "]
$ [" dev ", " www ", " sys ", " doc ", " vbox ", " chat ", " mus ", " vid ", " gfx "]
where
clickable l = [ "<action=xdotool key super+" ++ show (n) ++ ">" ++ ws ++ "</action>" |
(i,ws) <- zip [1..9] l,
let n = i ]
and in his xmobarrc
, commands = [
...
-- The workspaces are 'clickable' in my configs.
, Run UnsafeStdinReader
]
, template = " <action=`xdotool key control+alt+g`>...
and it looks that works, at least for him. You'll need 'xdotool' to make this work, in arch you can find it in the community repo, or clone it from here.
Something like this should work, I think:
clickable' :: ScreenId -> VirtualWorkspace -> String
clickable' s w = xmobarAction ("xmonadctl view\\\"" ++ marshall s w ++ "\\\"") "1" w
pp h s = marshallPP s def
{ ppHiddenNoWindows = xmobarColor "grey" "" . clickable' s
, -- and the other stuff
}
I haven't tested it, though...

Is it possible to intercept the encrypted HTTP body in Biztalk AS2 connection?

Is it possible to see the full HTTP request that was made towards an AS2 endpoint?
I tried Failed requests tracing from IIS but it does not show the body (probably because it is encrypted).
I would like to be able to replay the AS2 call using something like this:
POST http://aaa.com/PARTY/BTSHTTPReceive.dll HTTP/1.1
Content-Type: application/pkcs7-mime; smime-type=enveloped-data; name="smime.p7m"
Disposition-Notification-Options: signed-receipt-protocol=required,pkcs7-signature; signed-receipt-
micalg=required,sha1
AS2-Version: 1.2
Content-Transfer-Encoding: binary
Mime-Version: 1.0
Receipt-Delivery-Option: http://IPADDRESS/BiztalkMDN/BTSHTTPReceive.dll
EDIINT-Features: multiple-attachments
AS2-To: SOURCE
Message-ID: <NC-AZ-HQ-BZ-ACC_19ED90F5-1E8F-455F-A800-22917F2C5DF0>
AS2-From: DESTINATION
Disposition-Notification-To: http://IPADRESS/BiztalkMDN/BTSHTTPReceive.dll
User-Agent: Microsoft (R) BizTalk (R) Server
Host: ...
Content-Length: 2509
Expect: 100-continue
Connection: Close
0 * H
0 1 Q0 M 050!10Uaaa.com- JΎKJ 7J- *0
* H
f m zG$ jF9 Q1 : d, = T ׻r E 5 C #/ qx M kR [ mV / NǦ ÿ
a. =]: {yB_sgV [ `o zڛN L 1 ߭ R q jUۮy '/ p 7t :ƒ* l/Q " O QCF \ =cA# j (mV m x 3 = 'P & m(RR҉h0 K ) + #F pˮ PU0 Z * H
0* H
0
: 5& c.퀂0—D w | Θ y cO2 M z< pQL m 7 +%b fH *`f 8͚ ~=ԙ4b &9! b B # l1 " z \ Q S- . } " cZv >N.n% ̰| 3 a: :[1ӏZ k , W ̩J qjʉ =%7
7 l m ׵
b Inx : =Q p 1 + Gs
:) T; .O Uf Chڑ i , E HV+ ߣ G d g „{ V. e Q .L < vx T
; t < pA
j^J T O_ 9* [v=g4l c `5 Ԃ' H YS]߉ ' Ob $ 3 z 4 5 2 \3$IL : : T iy7; ԊE Z!{
[ \#x w k( OaaZ: | / h" U :! \u 4 V 8 v " M ϙv x "zL… p yĹ 2> +"p Ċ > t> v ӎ j l
ąN)j , { ǗG5 +UK y ~ 9 ڣ: A ֙ (# Չ 4
! .7y Aۣ . J j bhX .-j ) Z8( m^{=t哑[ | ^ Z )U 0[9V 5 L R3 , o ՝fj H!x 1J6 ( [F N <oq I ͓C a ': ˅ Ϊ ss{ ? hJ46 { Y>1 #- ֳ} 9* ʪ z tW U g8 o
De b ) 0SD6 7 ) I N yW| f s e qUz.q 55 ]! 2 y 'Ў F) y e # F a3 h
<k1 s 3 5 6 2 >6 2I5z|SNY / e 2?P ѽ. -U +
h x >2 m/Œ f cYSD ˇA 2u + ' 7CDT"#
h %; ~x R g Y K %> ?g| +h-:< , vT( c!1J h5 0 ) j T G 1 ʋL * ad 0pAv~XS - # ' gK~ u +fS | zr U U ҽ C ##m ӑ $ K CZ ̀ Y MixO 8 # IB %WwT: H M2 >˪ R Myn 0h$ 9# ' τ 7=+Vюx ` W{ b P Ob
KB
"қ pýG ;= 2UD ]ƜY+ bZ8) R +ٔL t QN Q
4ڎ #nJ+byK A p , U FS`i wY` U NwƽU< 27 ]* { 'CV ?QǓ L=`#C (! ^ 7k EJ? $ C )% f= A x L )^P t !Tu
~^A] 8" E/: t 3 P 5iG# "|J & U [MC $WUS&g %h)5 Ę mI ~ ÷ /mC Mq nNĝ Ǩ j *. }o E/ y G ד 1 h ?D m %˷ ^ DXy- mj_ [ dT
SM珍
k?[ - i ; 3i B[W͵ <w R YP; KGaF . Up}^ : .W " 3 뙲E _ hI }
SG 3 ι Œ hd * ++_Gz bc; D #
و y p ۧy A D k ŧ ? 5 t ^ <. . I' .Vp /&nVo N y0 b K 0 3QE
L vw tθ S /w 9 K նB x2Q#+Tj fC F R c
<Ad/ 1tlSfպ- w O0o =) T鏺 Q

Fix arrowShaft (Diagrams Library)

I've made a data storage symbol using B.difference and B.union. The one with the red dot in the middle.
dataStorage :: Diagram B
dataStorage = (strokePath $ B.difference Winding combined block1) # translateX (-0.3)
where block1 = (circle 0.5) # scaleX 0.5 # translateX (-1)
block2 = rect 2 1
block3 = (circle 0.5) # translateX (1)
combined = B.union Winding $ block2 <> block3
I've been trying for hours now but can't make an arrow straight between Previous Estimate written inside that symbol and Signal Decomposition (SSA). The goal is to draw the arrow starting at the center right outside of the symbol. Any help is welcome. Thank you very much.
EDIT 1: Added wanted result.
Here's the complete code.
{-# LANGUAGE NoMonomorphismRestriction #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TypeFamilies #-}
module FlowChartTR where
import System.Process
--import Graphics.SVGFonts
import Diagrams.Backend.SVG.CmdLine
import Diagrams.Prelude
import Diagrams.TwoD.Arrow
import qualified Diagrams.TwoD.Path.Boolean as B
oneLineText txt = text txt
twoLineText txt1 txt2 = center $ (text txt1) === strutY 0.2 === (text txt2)
threeLineText txt1 txt2 txt3 = center $
(text txt1) === strutY 0.2 === (text txt2) === strutY 0.2 === (text txt3)
terminal writeText w h r = (writeText <> roundedRect w h r) # lwL 0.02 # fontSize (local 0.2)
--terminalInput = (text "Input Data" <> roundedRect 1 0.3 0.3) # lwL 0.02 # fontSize (local 0.2)
--process txt w h = (text txt <> rect w h) # lwL 0.02 # fontSize (local 0.2)
process writeText w h = (writeText <> rect w h) # lwL 0.02 # fontSize (local 0.2)
dataStorage :: Diagram B
dataStorage = (strokePath $ B.difference Winding combined block1) # translateX (-0.3)
where block1 = (circle 0.5) # scaleX 0.5 # translateX (-1)
block2 = rect 2 1
block3 = (circle 0.5) # translateX (1)
combined = B.union Winding $ block2 <> block3
--decision :: Diagram B
--decision = (text "BPM" <> rect 0.4 0.3) # lwL 0.02 # fontSize (local 0.2)
input = (terminal (oneLineText "Input Data") 1.2 0.3 0.3) # named "terminalInput"
bandpass = (process (twoLineText "Bandpass" "Filtering") 1.5 0.5) # named "bandpass"
ssa = (process (threeLineText "Signal" "Decomposition" "(SSA)") 1.5 1) # translateY (-0.3) # named "ssa" # showOrigin
td = (process (twoLineText "Temporal" "Difference") 1 0.5) # named "td"
focuss = (process (threeLineText "Sparse Signal" "Reconstruction" "(FOCUSS)") 1.5 0.8) # named "focuss"
outputBPM = (terminal (oneLineText "Output BPM") 1.2 0.3 0.3) # named "terminalOutput"
spt = (process (threeLineText "Spectral Peak" "Tracking" "Select & Verif") 1.5 0.8) # named "spt"
prior = (oneLineText "Previous Estimate" <> dataStorage) # fontSize (local 0.2) # named "prior" #showOrigin # translateY 1
arrowStyle = (with & arrowHead .~ dart & headLength .~ large & tailLength .~ veryLarge)
ushaft = trailFromVertices (map p2 [(0, 0), (0.5, 0), (0.5, 1), (1, 1)])
arrowStyleU = (with & arrowHead .~ dart & headLength .~ large & tailLength .~ veryLarge & arrowShaft .~ ushaft)
decision :: Diagram B
decision = square 5 # rotate (45 ## deg) # scaleY 0.5
placeBlocks :: Diagram B
placeBlocks = atPoints [ P (V2 0 0), -- input
P (V2 4 0), -- bandpass
P (V2 8 0), -- ssa
P (V2 8 (-2)), -- td
P (V2 8 (-4)), -- focuss
P (V2 4 (-4)), -- spt
P (V2 0 (-4)), -- outputBPM
P (V2 4 (-2)) -- prior
] [input, bandpass,ssa, td, focuss, spt, outputBPM, prior]
flowChart :: Diagram B
flowChart = placeBlocks # connectOutside' arrowStyle "terminalInput" "bandpass"
# connectOutside' arrowStyle "bandpass" "ssa"
# connectOutside' arrowStyle "ssa" "td"
# connectOutside' arrowStyle "td" "focuss"
# connectOutside' arrowStyle "focuss" "spt"
# connectOutside' arrowStyle "spt" "terminalOutput"
# connectOutside' arrowStyle "prior" "spt"
# connectOutside' arrowStyleU "prior" "ssa"
# pad 1.1
flowChartTR :: IO ()
flowChartTR = mainWith flowChart
I got it. After I scaled down the symbol It becomes easier to adjust the connection.
Here's the changes.
...
[input, bandpass,ssa, td, focuss, spt, outputBPM, (prior # scale 0.7)]
...
# connectPerim' arrowStyleU "prior" "ssa" (0 ## deg) (205 ## deg)
...
NOTE:
- Adding arrowTail .~ lineTail is critical.

Where is the mistake in this Elliptic Curve code

I'm trying to write an implementation of elgamal with elliptic curves in haskell.
But there's some problem in my point addition function: as long as I keep adding the start point to itself I never reach the point at infinity (O).
Here is my code:
addP :: Curve->Point->Point->Point
addP _ O O = O
addP _ O p = p
addP _ p O = p
addP curve#(a,b,p) (P x1 y1) (P x2 y2) | x1 == x2 && y1 == -y2 = O
| otherwise = P x3 ((m*(x1-x3)-y1) `mod''` p)
where x3 = (((m*m)-x1-x2) `mod''` p)
m | x1 /= x2 = (y2-y1)/(x2-x1)
| otherwise = (3*(x1*x1)+a)/(2*y1)
Where Curve is defined as
-- first double=a, second double=b, third double=p in y^2=x^3+ax+b mod p
type Curve = (Double, Double, Double)
and Point is defined as
data Point = P Double Double |
P
deriving (Eq, Read, Show)
Does anyone know what I've done wrong?
as long as I keep adding the start point to itself I never reach the point at infinity (O).
Could you please post the reference/link where you learned this. I have very limit knowledge of Elliptic curves but I know little bit of Haskell so I tried to see what is going with your code. Very first thing I noticed the use of division and double while you are using modular arithmetic modulo prime p. I am not able to see what you mod'' does so I changed your code little bit and it's working fine for me.
type Curve = ( Integer , Integer , Integer )
data Point = P Integer Integer | O
deriving (Eq, Read, Show)
extendedGcd :: Integer -> Integer -> ( Integer , Integer )
extendedGcd a b
| b == 0 = ( 1 , 0 )
| otherwise = ( t , s - q * t ) where
( q , r ) = quotRem a b
( s , t ) = extendedGcd b r
modInv :: Integer -> Integer -> Integer
modInv a b
| gcd a b /= 1 = error " gcd is not 1 "
| otherwise = d where
d = until ( > 0 ) ( + b ) . fst.extendedGcd a $ b
addP :: Curve->Point->Point->Point
addP _ O O = O
addP _ O p = p
addP _ p O = p
addP ( a, b, p ) ( P x1 y1 ) ( P x2 y2 )
| x1 == x2 && mod ( y1 + y2 ) p == 0 = O
| otherwise = P x3 ( mod ( m * ( x1 - x3 ) - y1 ) p ) where
m | x1 /= x2 = ( mod ( y2 - y1 ) p ) * modInv ( mod ( x2 - x1 ) p ) p
| otherwise = ( 3 * x1 * x1 + a ) * modInv ( 2*y1 ) p
x3 = mod ( m * m - x1 - x2 ) p
Lets take curve y^2 = x^3 + x + 1 modulo 13. Z_13 = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 ]. Quadratic residue ( QR ) = [ 0, 1, 3, 4, 9, 10, 12] and Quadratic non residue ( QNR )= [ 2, 5, 6, 7, 8, 11] of Z_13. Take x = 0 and we have y^2 = 1 ( mod 13 ) since 1 is in QR so solution for this equation is 1 and 12. We get two points ( 0, 1 ) and ( 0, 12 ). Putting x = 1, y^2 = 3 ( mod 13 ) so points corresponding to x = 1 is ( 1, 4 ) and ( 1, 9). Putting x=2, y^2 = 11 ( mod 13 ) and 11 is QNR so we don't have solution. Whenever a solution exists, it gives us two points and both are inverse of each other modulo prime p ( 13 in this case ). Total points on given curve is ( 0, 1 ), ( 0, 12 ), ( 1, 4 ), ( 1, 9 ), ( 4, 2 ), ( 4, 11 ), ( 5, 1 ), ( 5, 12 ), ( 7, 0 ), ( 7, 0 ), ( 8, 1 ), ( 8, 12 ), ( 10, 6 ), ( 10, 7 ), ( 11, 2 ), ( 11, 11 ). You can try all the points and see which one generate the whole group.
*Main>take 20 . iterate ( addP ( 1 , 1 , 13 ) ( P 7 0 ) ) $ ( P 7 0 )
[P 7 0,O,P 7 0,O,P 7 0,O,P 7 0,O,P 7 0,O,P 7 0,O,P 7 0,O,P 7 0,O,P 7 0,O,P 7 0,O]
*Main> take 20 . iterate ( addP ( 1 , 1 , 13 ) ( P 0 12 ) ) $ ( P 0 12 )
[P 0 12,P 10 6,P 7 0,P 10 7,P 0 1,O,P 0 12,P 10 6,P 7 0,P 10 7,P 0 1,O,P 0 12,P 10 6,P 7 0,P 10 7,P 0 1,O,P 0 12,P 10 6]
Coming back to Elgamal system
1. Bob chose elliptic curve E( a, b) over GF( p ) or GF ( 2^n ).
2. Bob chose a point on the curve e1( x1, y1 )
3. Bob chose an integer d.
4. Bob calculate e2(x2, y2 ) = d * e1( x1, y1 ).
5. Bob announce E( a, b, p ), e1( x1, y1 ) and e2( x2, y2) as your public key and keeps d as private key
Encryption.
Alice selects P, point on the curve, as her plain text. She chose a random number r and computes C1 = r * e1, C2 = P + r * e2.
Decryption.
Bob after receiving C1 and C2, computes C2 - d * C1 => P + r * e2 - d * r * e1
=> P + r * d * e1 - d * r * e1 => P
Edit: You are correct! If you take generator element and keep adding it then you can generate the whole group. See the lecture by Christof Paar[1].
[1]https://www.youtube.com/watch?v=3S9eZRHjP8g&list=PLn_QCKxjl9zmx3VojkDqljZcLCIslz7kB&index=37

Resources